Module: CarrierWave::Mongoid
- Includes:
- Mount
- Defined in:
- lib/carrierwave/orm/mongoid.rb
Instance Method Summary collapse
-
#mount_uploader(column, uploader, options = {}, &block) ⇒ Object
See CarrierWave::Mount#mount_uploader for documentation.
Methods included from Mount
#uploader_option, #uploader_options, #uploaders
Instance Method Details
#mount_uploader(column, uploader, options = {}, &block) ⇒ Object
See CarrierWave::Mount#mount_uploader for documentation
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/carrierwave/orm/mongoid.rb', line 10 def mount_uploader(column, uploader, ={}, &block) [:mount_on] ||= "#{column}_filename" field [:mount_on] super alias_method :read_uploader, :read_attribute alias_method :write_uploader, :write_attribute after_save "store_#{column}!".to_sym before_save "write_#{column}_identifier".to_sym after_destroy "remove_#{column}!".to_sym end |