Class: BlueberryCMS::Link

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
app/models/blueberry_cms/link.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(id) ⇒ Object



16
17
18
19
20
21
# File 'app/models/blueberry_cms/link.rb', line 16

def self.find(id)
  _id = BSON::ObjectId.from_string(id)
  page  = BlueberryCMS::Page.find_by('blocks.links._id' => _id)
  links = page.blocks.find_by('links._id' => _id)
  links.links.find_by('_id' => _id)
end

Instance Method Details

#pageObject



23
24
25
# File 'app/models/blueberry_cms/link.rb', line 23

def page
  Page.find(page_id) if page_id
end