Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## model class Asset < ActiveRecord::Base has_attachment :storage => :file_system, :thumbnails => { :polaroid => '193x193', :fullscreen => '800>', :large => "300>", :thumb => '120>', :tiny => '50>' }, :max_size => 5.megabytes, :path_prefix => "public/image_assets" validates_as_attachment def regenerate_thumbnail ActiveRecord::Base.record_timestamps = false begin self.temp_data = temp_data save! ensure ActiveRecord::Base.record_timestamps = true end end end ## migration class RegenerateThumbs < ActiveRecord::Migration def self.up Asset.find(:all, :conditions => 'parent_id is null').each &:regenerate_thumbnail end def self.down # poo end end
This paste will be private.
From the Design Piracy series on my blog: