Module: ActiveScaffold::Bridges::Carrierwave::Lib::CarrierwaveBridge

Defined in:
lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
# File 'lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb', line 18

def self.included(base)
  base.alias_method_chain :initialize, :carrierwave
end

Instance Method Details

#initialize_with_carrierwave(model_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb', line 6

def initialize_with_carrierwave(model_id)
  initialize_without_carrierwave(model_id)
  return unless self.model.respond_to?(:uploaders) && self.model.uploaders.present?
      
  self.update.multipart = true
  self.create.multipart = true
      
  self.model.uploaders.keys.each do |field|
    configure_carrierwave_field(field.to_sym)
  end
end