Sha256: ec81fb5650c4a7d0b9aa469e0999bc14b038a1f069bb26ebeade6e21db5b2ee3
Contents?: true
Size: 1.13 KB
Versions: 12
Compression:
Stored size: 1.13 KB
Contents
class Index < ActiveRecord::Base attr_accessible :name, :page_title, :keywords, :page_description, :texts_attributes, :photos_attributes, :videos_attributes, :downloadables_attributes, :gallery_attributes has_many :indices, :as => :owner, :dependent => :destroy belongs_to :owner, :polymorphic => true has_one :gallery, :dependent => :destroy has_many :texts, :dependent => :destroy has_many :photos, :dependent => :destroy has_many :videos, :dependent => :destroy has_many :downloadables, :dependent => :destroy accepts_nested_attributes_for :videos, :reject_if => lambda { |a| a[:remote_id].blank? }, :allow_destroy => true accepts_nested_attributes_for :photos, :reject_if => lambda { |a| a[:asset].blank? }, :allow_destroy => true accepts_nested_attributes_for :downloadables, :reject_if => lambda { |a| a[:asset].blank? }, :allow_destroy => true accepts_nested_attributes_for :texts, :reject_if => lambda { |a| a[:content].blank?}, :allow_destroy => true accepts_nested_attributes_for :gallery, :allow_destroy => true def assets (texts + photos + videos + downloadables).sort_by{|a| a.priority || 99} end end
Version data entries
12 entries across 12 versions & 2 rubygems