Sha256: 7d6e9832951622ed61b92f8688e04d7b8b94b137b8fe03087ee42ba6abe7047b
Contents?: true
Size: 688 Bytes
Versions: 3
Compression:
Stored size: 688 Bytes
Contents
module ActiveRecord module Acts module Asset def self.included(base) base.extend(ClassMethods) end module ClassMethods def acts_as_asset has_one :asset, :as => :content, :dependent => :destroy, :class_name => "Asset" accepts_nested_attributes_for :asset include ActiveRecord::Acts::Asset::InstanceMethods end end module InstanceMethods def name asset.name end def media_type "generic" end def icon "/images/#{media_type}.png" end end end end end ActiveRecord::Base.send(:include, ActiveRecord::Acts::Asset)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fassets_core-0.4.0 | lib/acts_as_asset.rb |
fassets_core-0.3.1 | lib/acts_as_asset.rb |
fassets_core-0.3.0 | lib/acts_as_asset.rb |