diff --git a/app/models/plan.rb b/app/models/plan.rb index 30fd5b2..9ef0a14 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -730,8 +730,8 @@ def self.load_for_phase(id, phase_id) plan = Plan .joins(template: { phases: { sections: :questions }}) + .preload(template: { phases: { sections: :questions }}) # Preserves the default order defined in the model relationships .where("plans.id = :id AND phases.id = :phase_id", { id: id, phase_id: phase_id }) - .includes(template: { phases: { sections: :questions }}) .merge(Plan.includes(answers: :notes))[0] phase = plan.template.phases.first return plan, phase diff --git a/app/views/phases/_edit_plan_answers.html.erb b/app/views/phases/_edit_plan_answers.html.erb index aadfd72..1c746c2 100644 --- a/app/views/phases/_edit_plan_answers.html.erb +++ b/app/views/phases/_edit_plan_answers.html.erb @@ -24,7 +24,7 @@
- <% phase.sections.order(:number).each do |section| %> + <% phase.sections.each do |section| %> <% sectionid = section.id %>