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

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

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

Instance Method Details

#initialize_with_carrierwave(model_id) ⇒ Object



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

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