Module: ConcurrentDraft::PageExtensions

Defined in:
lib/concurrent_draft/page_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/concurrent_draft/page_extensions.rb', line 3

def self.included(base)
  base.class_eval do
    alias_method_chain :parse_object, :drafts
  end
end

Instance Method Details

#promote_draft!Object



9
10
11
12
13
# File 'lib/concurrent_draft/page_extensions.rb', line 9

def promote_draft!
  parts.reload.each(&:promote_draft!)
  update_attribute('status_id', Status[:published].id)
  super
end

#unpublish!Object



15
16
17
18
19
# File 'lib/concurrent_draft/page_extensions.rb', line 15

def unpublish!
  parts.each(&:unpublish!)
  update_attributes('published_at' => nil, 'status_id' => Status[:draft].id)
  super
end