Class: CustomFields::Types::File::FileUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- CustomFields::Types::File::FileUploader
- Defined in:
- lib/custom_fields/types/file.rb
Instance Method Summary collapse
Instance Method Details
#set_size_in_model ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/custom_fields/types/file.rb', line 90 def set_size_in_model size_field_name = :"#{mounted_as}_size" if model.respond_to?(size_field_name) is_localized = model.fields[mounted_as.to_s].[:localize] key = is_localized ? ::Mongoid::Fields::I18n.locale.to_s : 'default' values = model.send(size_field_name) values[key] = file.size end end |