Sha256: ea4a42df17eef67fdb2a0da3b2702e1964ea2e1c7bb84232fe49924c8936e08e
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
class Index < ActiveRecord::Base attr_accessible :name, :title, :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 extend FriendlyId friendly_id :name, :use => :slugged 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sbdevcore-0.2.2 | app/models/index.rb |
sbdevcore-0.2.0 | app/models/index.rb |