Class: Dust::Builder::Page

Inherits:
Object
  • Object
show all
Defined in:
app/models/dust/builder/page.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Page

Returns a new instance of Page.



5
6
7
8
9
# File 'app/models/dust/builder/page.rb', line 5

def initialize(options={})
  @page       = options[:page]
  @sections   = options[:sections] || []
  @page_attrs = options[:attrs] if options[:attrs]
end

Instance Method Details

#saveObject



11
12
13
14
15
16
17
18
19
# File 'app/models/dust/builder/page.rb', line 11

def save
  build_sections
  update_blocks
  if @page.errors.blank?
    @page.save
  else
    false
  end
end

#updateObject



21
22
23
24
25
26
27
28
29
# File 'app/models/dust/builder/page.rb', line 21

def update
  build_sections
  update_blocks
  if @page.errors.blank?
    @page.update_attributes(@page_attrs)
  else
    false
  end
end