diff --git a/app/models/competition_module.rb b/app/models/competition_module.rb index 3fdab6b37..3b1bfddda 100644 --- a/app/models/competition_module.rb +++ b/app/models/competition_module.rb @@ -3,7 +3,7 @@ class CompetitionModule < ApplicationRecord belongs_to :competition - has_one :competition_module_md_content, dependent: :destroy + has_many :competition_module_md_contents, dependent: :destroy def module_url result_url = url.present? ? url : case module_type diff --git a/app/views/competitions/competition_modules/show.json.jbuilder b/app/views/competitions/competition_modules/show.json.jbuilder index 116934ee8..14c3c0f57 100644 --- a/app/views/competitions/competition_modules/show.json.jbuilder +++ b/app/views/competitions/competition_modules/show.json.jbuilder @@ -1,6 +1,6 @@ json.extract! @module, :id, :name, :position, :url -md = @module.competition_module_md_content +md = @module.competition_module_md_contents.take if md.present? json.md_id md.id json.md_name md.name