Skip to content

Commit

Permalink
Quick fix for creating thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
solum13 committed Oct 7, 2008
1 parent cda2d14 commit 9d75401
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/technoweenie/attachment_fu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def self.extended(base)
base.after_save :after_process_attachment
base.after_destroy :destroy_file
base.after_validation :process_attachment
base.attr_accessible
base.attr_accessible :uploaded_data
if defined?(::ActiveSupport::Callbacks)
base.define_callbacks :after_resize, :after_attachment_saved, :before_thumbnail_saved
end
Expand Down Expand Up @@ -274,12 +274,12 @@ def thumbnail_name_for(thumbnail = nil)
def create_or_update_thumbnail(temp_file, file_name_suffix, *size)
thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column"))
returning find_or_initialize_thumbnail(file_name_suffix) do |thumb|
thumb.attributes = {
thumb.temp_paths.unshift temp_file
thumb.send(:'attributes=', {
:content_type => content_type,
:filename => thumbnail_name_for(file_name_suffix),
:temp_path => temp_file,
:thumbnail_resize_options => size
}
}, false)
callback_with_args :before_thumbnail_saved, thumb
thumb.save!
end
Expand Down

0 comments on commit 9d75401

Please sign in to comment.