escribí un post sobre ello hace unos meses. También escribí sobre cómo puede agregar propiedades de la clase, por ejemplo, no usar una identificación (no me gusta) y usar un token.
Read the post here...
Los fundamentos:
para obtener una ruta con un id
has_attached_file :avatar,
:styles =>
{
:tiny => "48x48>",
:preview => "175x175>",
:large => "300x300>",
:huge => "500x500>"
},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => ":class/:attachment/:id/:style.:extension",
:bucket => 'lopsum',
:default_url => "/images/photo01.jpg"
y, si se desea cambiar a otra cosa ...
has_attached_file :avatar,
:styles =>
{
:tiny => "48x48>",
:preview => "175x175>",
:large => "300x300>",
:huge => "500x500>"
},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => ":class/:attachment/:token/:style.:extension",
:bucket => 'lopsum',
:default_url => "/images/photo01.jpg"
y en un inicializador
Paperclip.interpolates :token do |attachment, style|
attachment.instance.token
end