Sha256: 216d6692aac9af6cdd3d5510550b065064143679c4f874a7cfd64ef664b4709a

Contents?: true

Size: 726 Bytes

Versions: 36

Compression:

Stored size: 726 Bytes

Contents

module ActiveScaffold
  module Bridges
    class Carrierwave
      module CarrierwaveBridge
        def initialize(model_id)
          super
          return unless model.respond_to?(:uploaders) && model.uploaders.present?

          update.multipart = true
          create.multipart = true

          model.uploaders.each_key do |field|
            configure_carrierwave_field(field.to_sym)
          end
        end

        private

        def configure_carrierwave_field(field)
          columns << field
          columns[field].form_ui ||= :carrierwave # :TODO thumbnail
          columns[field].params.add "#{field}_cache"
          columns[field].params.add "remove_#{field}"
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
active_scaffold-4.0.0 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-4.0.0.rc3 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.11 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-4.0.0.rc2 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.10 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-4.0.0.rc1 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.8 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.7 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.6 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.5 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.2 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.1 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.7.0 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.20 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.19 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.17 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.15 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.14 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.13 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
active_scaffold-3.6.12 lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb