diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 6d2c907..cf63cc1 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -3,7 +3,7 @@ class Admin::PagesController < AdminController def index @pages = Page.includes(phase: :project).order(id: :desc) - @projects = @pages.map { |page| page.phase.project }.uniq + @projects = @pages.map { |page| page.phase&.project }.uniq end def show diff --git a/db/migrate/20240613113501_add_was_published_and_published_at_to_project_revisions.rb b/db/migrate/20240613113501_add_was_published_and_published_at_to_project_revisions.rb index b9f8843..a87e2b6 100644 --- a/db/migrate/20240613113501_add_was_published_and_published_at_to_project_revisions.rb +++ b/db/migrate/20240613113501_add_was_published_and_published_at_to_project_revisions.rb @@ -6,7 +6,7 @@ def up Phase.find_each do |phase| if phase.published_revision.present? published_revision = phase.published_revision - published_revision.update_attributes(was_published: true, published_at: published_revision.updated_at) + published_revision.update_attributes!(was_published: true, published_at: published_revision.updated_at) end end end diff --git a/db/migrate/20240621112043_add_phase_to_pages.rb b/db/migrate/20240621112043_add_phase_to_pages.rb index acb2e1e..7613706 100644 --- a/db/migrate/20240621112043_add_phase_to_pages.rb +++ b/db/migrate/20240621112043_add_phase_to_pages.rb @@ -5,7 +5,7 @@ def change Project.find_each do |project| project.phases.find_each do |phase| phase.revisions.find_each do |phase_revision| - phase_revision.revision.page.update(phase_id: phase.id) + phase_revision.revision.page.update!(phase_id: phase.id) end end end