Sha256: 6eba49dd71c02d7769a80d7f29f0ab57b66de877913c1b083955ec48ccfd10d8
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
# encoding: utf-8 require 'mongoid' require 'carrierwave/validations/active_model' module CarrierWave module Mongoid include CarrierWave::Mount ## # See +CarrierWave::Mount#mount_uploader+ for documentation # 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 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) before_save "check_stale_#{column}!".to_sym after_save "rename_#{column}!".to_sym after_save "store_#{column}!".to_sym before_save "write_#{column}_identifier".to_sym after_destroy "remove_#{column}!".to_sym end end # Mongoid end # CarrierWave Mongoid::Document::ClassMethods.send(:include, CarrierWave::Mongoid)
Version data entries
4 entries across 4 versions & 1 rubygems