Module: ActiveScaffold::Bridges::Dragonfly::DragonflyBridge

Defined in:
lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



17
18
19
# File 'lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb', line 17

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

Instance Method Details

#initialize_with_dragonfly(model_id) ⇒ Object



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

def initialize_with_dragonfly(model_id)
  initialize_without_dragonfly(model_id)
  return unless self.model.respond_to?(:dragonfly_attachment_classes) && self.model.dragonfly_attachment_classes.present?

  self.update.multipart = true
  self.create.multipart = true

  self.model.dragonfly_attachment_classes.each do |attachment|
    configure_dragonfly_field(attachment.attribute)
  end
end