Module: Imhotep::Models::Page::ClassMethods

Defined in:
lib/imhotep/models/page.rb

Instance Method Summary collapse

Instance Method Details

#find_or_build(path, name, attributes = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/imhotep/models/page.rb', line 11

def find_or_build(path, name, attributes = nil)
  page = find_by_path_and_name(path, name)
  
  unless page
    page = new
    page.path = path
    page.name = name
  end
  
  page
end