From 26030c71c7b300c30367222f263d74b8d2142ecf Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 25 Jun 2026 17:50:55 +0200 Subject: Rails 5.2 application fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename before_filter → before_action across all controllers - Fix string conditions in validators to lambda syntax (node.rb) - Fix publish_draft!: move staged slug/parent logic outside draft guard, use move_to_child_of for parent changes, add nil guard for no-op calls - Fix update_unique_names_of_children: use parent_id traversal instead of lft/rgt descendants (awesome_nested_set 3.x lft/rgt update bug) - Fix unique_path to return Array instead of String - Fix Occurrence.delete_all syntax for Rails 5 - Fix Page.find_with_outdated_translations: use includes instead of all - Fix outdated_translations?: use find instead of splat array --- app/models/page.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/models/page.rb') diff --git a/app/models/page.rb b/app/models/page.rb index e2cbee5..93debf8 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -83,7 +83,7 @@ class Page < ActiveRecord::Base # outdated_translations? for more information. # Takes :locale => and :delta_time => 12.hours as options def self.find_with_outdated_translations options = {} - Page.all(:include => :translations).select do |page| + Page.includes(:translations).select do |page| page.outdated_translations? options end end @@ -182,8 +182,8 @@ class Page < ActiveRecord::Base translations = self.translations - default = *(translations.select {|x| x.locale == I18n.default_locale}) - custom = *(translations.select {|x| x.locale == options[:locale]}) + default = translations.find {|x| x.locale.to_s == I18n.default_locale.to_s } + custom = translations.find {|x| x.locale.to_s == options[:locale].to_s } if translations.size > 1 && default && custom difference = (default.updated_at - custom.updated_at).to_i.abs -- cgit v1.3