module CarrierWave::Mongoid

Public Instance Methods

mount_uploader(column, uploader, options={}, &block) click to toggle source

See +CarrierWave::Mount#mount_uploader+ for documentation

# File lib/carrierwave/orm/mongoid.rb, line 9
def mount_uploader(column, uploader, options={}, &block)
  options[:mount_on] ||= "#{column}_filename"
  field options[: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