Sha256: 171f89fab895cd04a90173cf7c4e02546cce81262e245d0efae5b4a6e76ed5c5

Contents?: true

Size: 849 Bytes

Versions: 41

Compression:

Stored size: 849 Bytes

Contents

module ActiveScaffold
  module Bridges
    module Paperclip
      module Lib
        module PaperclipBridgeHelpers
          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.#{field} = nil unless self.#{field}.dirty?
              end
            EOF
          end
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 4 rubygems

Version Path
active_scaffold_vho-3.0.31 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.30 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.29 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.28 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.27 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.26 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.25 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.26 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.25 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.24 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_clarity-3.0.24.2 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.23 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.22 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.24 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.21 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.23 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.22 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold-3.0.21 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.20 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
active_scaffold_vho-3.0.19 lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb