Module: ActiveScaffold::Bridges::Paperclip::Lib::PaperclipBridge

Defined in:
lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



20
21
22
# File 'lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb', line 20

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

Instance Method Details

#initialize_with_paperclip(model_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb', line 6

def initialize_with_paperclip(model_id)
  initialize_without_paperclip(model_id)
  return unless self.model.respond_to?(:attachment_definitions) && !self.model.attachment_definitions.nil? 
      
  self.update.multipart = true
  self.create.multipart = true
      
  self.model.attachment_definitions.keys.each do |field|
    configure_paperclip_field(field.to_sym)
    # define the "delete" helper for use with active scaffold, unless it's already defined
    ActiveScaffold::Bridges::Paperclip::Lib::PaperclipBridgeHelpers.generate_delete_helper(self.model, field)
  end
end