Module: AbAdmin::CarrierWave::Glue::ClassMethods

Defined in:
lib/ab_admin/carrierwave/glue.rb

Instance Method Summary collapse

Instance Method Details

#ab_admin_uploader(uploader = nil, options = {}, &block) ⇒ Object


7
8
9
10
11
12
# File 'lib/ab_admin/carrierwave/glue.rb', line 7

def ab_admin_uploader(uploader=nil, options={}, &block)
  options.reverse_merge!(mount_on: :data_file_name)
  options.merge!(validate_integrity: false, validate_processing: false, validate_download: false) unless uploader.try!(:enable_processing)
  
  mount_uploader(:data, uploader, options, &block)
end

#sunrise_uploader(*args) ⇒ Object


14
15
16
17
# File 'lib/ab_admin/carrierwave/glue.rb', line 14

def sunrise_uploader(*args)
  ActiveSupport::Deprecation.warn('`sunrise_uploader` is deprecated, use `ab_admin_uploader` instead')
  ab_admin_uploader(*args)
end

#validates_filesize_of(*attr_names) ⇒ Object


19
20
21
# File 'lib/ab_admin/carrierwave/glue.rb', line 19

def validates_filesize_of(*attr_names)
  validates_with FileSizeValidator, _merge_attributes(attr_names)
end