db/model/page_node.rb in aerogel-pages-1.4.12 vs db/model/page_node.rb in aerogel-pages-1.4.14

- old
+ new

@@ -14,10 +14,12 @@ accepts_nested_attributes_for :pages, reject_if: :all_blank, allow_destroy: true before_update :touch_ancestors + before_update :touch_pages + before_update :denormalize_position before_destroy :touch_ancestors # scope :with_content, ->(lang) { where( :'pages.lang' => lang ) } # scope :published, ->(lang) { elem_match( pages: { lang: lang, :publication_state => :published } ) } # scope :published_and_hidden, ->(lang) { @@ -36,8 +38,18 @@ # def touch_ancestors ancestors.update_all updated_at: Time.now end + # Touches pages (if present) + # + def touch_pages + pages.update_all updated_at: Time.now + end + # Denormalize +position+ to owned Page(s). + # + def denormalize_position + pages.update_all( position: position ) + end end # class Page