Report abuse

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