module ErpTechSvcs::Extensions::ActiveRecord::HasFileAssets::ClassMethods
If set to auto destroy any files related to a model via this mixin will automatically be removed regardless of any other relationships they have. It defaults to true since most files should be removed when the model is removed.
Public Instance Methods
has_file_assets(auto_destroy=true)
click to toggle source
# File lib/erp_tech_svcs/extensions/active_record/has_file_assets.rb, line 14 def has_file_assets(auto_destroy=true) extend HasFileAssets::SingletonMethods include HasFileAssets::InstanceMethods if auto_destroy before_destroy :destroy_all_files end has_many :file_asset_holders, :as => :file_asset_holder, :dependent => :destroy has_many :files, :through => :file_asset_holders, :class_name => 'FileAsset', :source => :file_asset, :include => :capabilities end