Sha256: a84f4b144647cc84d1bc22930439d3a268a7fde5c572871ec06ce3cedaea6c89

Contents?: true

Size: 846 Bytes

Versions: 14

Compression:

Stored size: 846 Bytes

Contents

module ActiveScaffold
  module Bridges
    module Carrierwave
      module Lib
        module CarrierwaveBridgeHelpers
          mattr_accessor :thumbnail_style
          self.thumbnail_style = :thumbnail
        
          def self.generate_delete_helper(klass, field)
            klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("delete_#{field}=")
              attr_reader :delete_#{field}
        
              def delete_#{field}=(value)
                value = (value == "true") if String === value
                return unless value
        
                # passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
                self.remove_#{field}! unless new_record?
              end
            EOF
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
active_scaffold_vho-3.0.12 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.11 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.12 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.11 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.10 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.9 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.8 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.7 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold_vho-3.0.6 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.5 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.4 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.2 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.1 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb
active_scaffold-3.0.0 lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb