lib/loaders/paperclip/image_loading.rb in datashift-0.10.2 vs lib/loaders/paperclip/image_loading.rb in datashift-0.11.0

- old
+ new

@@ -12,13 +12,10 @@ module ImageLoading include DataShift::Paperclip - def initialize(attachment_klazz, attachment = nil, options = {}) - super( attachment_klazz, attachment, options ) - end # Note the paperclip attachment model defines the storage path via something like : # # => :path => ":rails_root/public/blah/blahs/:id/:style/:basename.:extension" # @@ -31,18 +28,20 @@ # such as Product, User etc all of which can have an Image # # :viewable_record # def create_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {}) - - attachment_options = options.dup - - attributes = {:alt => (options[:alt] || "") } - - attributes[:position] = (!options[:position] && record and record.respond_to?(:images)) ? record.images.length : 0 + + image_attributes = { :attributes => + { :alt => (options[:alt] || ""), + :position => (!options[:position] && record and record.respond_to?(:images)) ? record.images.length : 0 + } + } - attachment_options.merge!( attributes ) - + attachment_options = options.dup.merge(image_attributes) + + #puts "DEBUG : create_attachment options : #{attachment_options.inspect}" + super(klass, attachment_path, record, attach_to_record_field, attachment_options) end # Set of file extensions ImageMagik can process so default glob # we use to find image files within directories