Module: CarrierWave::MongoModel::ClassMethods
- Includes:
- CarrierWave::Mount
- Defined in:
- lib/carrierwave_ext/mongo_model.rb
Instance Method Summary collapse
-
#mount_uploader(column, uploader, options = {}, &block) ⇒ Object
See CarrierWave::Mount#mount_uploader for documentation.
Instance Method Details
#mount_uploader(column, uploader, options = {}, &block) ⇒ Object
See CarrierWave::Mount#mount_uploader for documentation
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/carrierwave_ext/mongo_model.rb', line 20 def mount_uploader(column, uploader, ={}, &block) fname_attribute = :"#{column}_filename" attr_accessor fname_attribute [:mount_on] ||= fname_attribute super # include CarrierWave::Validations::ActiveModel # validates_integrity_of column if uploader_option(column.to_sym, :validate_integrity) # validates_processing_of column if uploader_option(column.to_sym, :validate_processing) after_save "store_#{column}!".to_sym before_save "write_#{column}_identifier".to_sym after_destroy "remove_#{column}!".to_sym end |