Sha256: f763cb6091be4fc7ca800baea7627569bca40d87e15cbc5ec76183e2077966d2
Contents?: true
Size: 605 Bytes
Versions: 5
Compression:
Stored size: 605 Bytes
Contents
class ManageableContent::Page < ActiveRecord::Base validates :locale, :presence => true has_many :page_contents, :dependent => :delete_all scope :with_contents, lambda { includes(:page_contents).joins(:page_contents) } attr_accessible :page_contents_attributes accepts_nested_attributes_for :page_contents # Retrieves a PageContent with the given key. # def page_content(key) key = key.to_s page_contents.detect { |page_content| page_content.key == key } end # Retrieves a content with the given key. # def content(key) page_content(key).try(:content) end end
Version data entries
5 entries across 5 versions & 1 rubygems