Sha256: 04fb212e318dae126e45cf288a5c856f044eade9fb658a9c0612376c4aeb2abb

Contents?: true

Size: 1009 Bytes

Versions: 71

Compression:

Stored size: 1009 Bytes

Contents

module ActiveScaffold
  module Bridges
    class Dragonfly
      module DragonflyBridge
        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

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

        private
        def configure_dragonfly_field(field)
          self.columns << field
          self.columns[field].form_ui ||= :dragonfly
          self.columns[field].params.add "remove_#{field}"

          [:name, :uid].each do |f|
            self.columns.exclude("#{field}_#{f}".to_sym)
          end
        end
      end
    end
  end
end

Version data entries

71 entries across 71 versions & 2 rubygems

Version Path
active_scaffold-sequel-0.8.0 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.17 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.16 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.14 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.13 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.12 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-sequel-0.7.1 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.11 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.10 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.9 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.8 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.7 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.5 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.4 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.3 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.2 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.1 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.0.1 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-3.4.0 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
active_scaffold-sequel-0.7.0 lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb