app/models/page.rb in refinerycms-pages-1.0.9 vs app/models/page.rb in refinerycms-pages-1.0.10

- old
+ new

@@ -20,26 +20,17 @@ # set allowed attributes for mass assignment ::Page::Translation.send :attr_accessible, :browser_title, :meta_description, :meta_keywords, :locale if ::Page::Translation.table_exists? - def translation - if @translation.nil? or @translation.try(:locale) != ::Globalize.locale - @translation = translations.with_locale(::Globalize.locale).first - @translation ||= translations.build(:locale => ::Globalize.locale) - end - - @translation - end - # Instruct the Translation model to have meta tags. ::Page::Translation.send :is_seo_meta fields = ::SeoMeta.attributes.keys.reject{|f| self.column_names.map(&:to_sym).include?(f) }.map{|a| [a, :"#{a}="]}.flatten delegate *(fields << {:to => :translation}) - after_save proc {|m| m.translation.save} + before_save {|m| m.translation.save} end end before_create :ensure_locale, :if => proc { |c| ::Refinery.i18n_enabled?