Module: PageAssetAssociations

Defined in:
lib/page_asset_associations.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

TODO: Turn page_attachments into a generic, polymorphic asset-attachment mechanism



5
6
7
8
9
10
11
# File 'lib/page_asset_associations.rb', line 5

def self.included(base)
  base.class_eval {
    has_many :page_attachments, -> { order 'position desc' }
    has_many :assets,{ :through => :page_attachments},  -> { order 'page_attachments.position ASC' }
    accepts_nested_attributes_for :page_attachments, :allow_destroy => true
  }
end