Sha256: d4a22a1de661d15b22cccd5b6c014d2a54a963466b9ccb1f7cc402c38b8c4cf8
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 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 class_underscore self.class.to_s.underscore end def media_type "generic" end def icon "/images/#{media_type}.png" end protected def put_on_tray tray_positions.create(:user_id => self.user_id) end end end end end ActiveRecord::Base.send(:include, ActiveRecord::Acts::Asset)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fassets_core-0.2.0 | lib/acts_as_asset.rb |