diff options
| author | hukl <contact@smyck.org> | 2009-03-29 16:35:33 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-03-29 16:35:33 +0200 |
| commit | 74aae2ad573118b46522c65b5f682da6a8d8c8e2 (patch) | |
| tree | 0db292abc8fd7042327c9fee1294393da47dcd71 | |
| parent | c2fa7429dfb10a018731320a49e7ea061feef784 (diff) | |
minor refactor
| -rw-r--r-- | app/models/page.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/app/models/page.rb b/app/models/page.rb index b11b43c..dfabecf 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -148,14 +148,12 @@ class Page < ActiveRecord::Base | |||
| 148 | options = default_options.merge options | 148 | options = default_options.merge options |
| 149 | 149 | ||
| 150 | translations = self.globalize_translations | 150 | translations = self.globalize_translations |
| 151 | locales = translations.map {|l| l.locale} | ||
| 152 | 151 | ||
| 153 | default = *(translations.select {|x| x.locale == I18n.default_locale}) | 152 | default = *(translations.select {|x| x.locale == I18n.default_locale}) |
| 154 | custom = *(translations.select {|x| x.locale == options[:locale]}) | 153 | custom = *(translations.select {|x| x.locale == options[:locale]}) |
| 155 | 154 | ||
| 156 | if translations.size > 1 && default && custom | 155 | if translations.size > 1 && default && custom |
| 157 | time = default.updated_at - custom.updated_at | 156 | difference = (default.updated_at - custom.updated_at).to_i.abs |
| 158 | difference = time.to_i.abs | ||
| 159 | return (options[:delta_time].to_i.abs < difference) | 157 | return (options[:delta_time].to_i.abs < difference) |
| 160 | else | 158 | else |
| 161 | return false | 159 | return false |
