diff options
Diffstat (limited to 'app/models/page.rb')
| -rw-r--r-- | app/models/page.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index e2cbee5b..93debf82 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -83,7 +83,7 @@ class Page < ActiveRecord::Base | |||
| 83 | # outdated_translations? for more information. | 83 | # outdated_translations? for more information. |
| 84 | # Takes :locale => <locale> and :delta_time => 12.hours as options | 84 | # Takes :locale => <locale> and :delta_time => 12.hours as options |
| 85 | def self.find_with_outdated_translations options = {} | 85 | def self.find_with_outdated_translations options = {} |
| 86 | Page.all(:include => :translations).select do |page| | 86 | Page.includes(:translations).select do |page| |
| 87 | page.outdated_translations? options | 87 | page.outdated_translations? options |
| 88 | end | 88 | end |
| 89 | end | 89 | end |
| @@ -182,8 +182,8 @@ class Page < ActiveRecord::Base | |||
| 182 | 182 | ||
| 183 | translations = self.translations | 183 | translations = self.translations |
| 184 | 184 | ||
| 185 | default = *(translations.select {|x| x.locale == I18n.default_locale}) | 185 | default = translations.find {|x| x.locale.to_s == I18n.default_locale.to_s } |
| 186 | custom = *(translations.select {|x| x.locale == options[:locale]}) | 186 | custom = translations.find {|x| x.locale.to_s == options[:locale].to_s } |
| 187 | 187 | ||
| 188 | if translations.size > 1 && default && custom | 188 | if translations.size > 1 && default && custom |
| 189 | difference = (default.updated_at - custom.updated_at).to_i.abs | 189 | difference = (default.updated_at - custom.updated_at).to_i.abs |
