Sha256: d9f3cc0c65a37b52c64c89f18b13c9ce025ef369f1e5e11dd3e9622309f00070
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
module ActiveScaffold module Bridges class Paperclip 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.instance_methods.include?("delete_#{field}=".send(::ActiveScaffold::METHOD_CONVERSION)) 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_scaffold-3.3.0 | lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb |
active_scaffold-3.2.20 | lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb |