Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
class ModelWithPaperclipAttachment < ActiveRecord::Base #'name' is the only attribute on this model except any attributes required by paperclip (i forget how it does that) has_attached_file :attachment_name, :path => ":rails_root/:class/:name/:basename.:extension end #so files will be saved at "#{RAILS_ROOT}/ModelWithPaperclipAttachment/#{name attribute of the instance of this model}/#{filename and base}" #paperclip comes with some built in interpolations like :id and some others but i forget them at this time ## # paperclip custom initializer # this is in the config/initializers directory in a file Paperclip::Attachment.interpolations[:name] = lambda do |attachment, style| attachment.instance.name end
This paste will be private.
From the Design Piracy series on my blog: