Module: CarrierWave::ActiveRecord
- Includes:
- Mount
- Defined in:
- lib/carrierwave/orm/activerecord.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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/carrierwave/orm/activerecord.rb', line 14 def mount_uploader(column, uploader, ={}, &block) super alias_method :read_uploader, :read_attribute alias_method :write_uploader, :write_attribute public :read_uploader public :write_uploader 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}!" before_save "write_#{column}_identifier" after_destroy "remove_#{column}!" end |