I've been playing around with using Paperclip to build a photo gallery/store. A Gallery has many Photos, and a Photo belongs to a Gallery, and Users can have many Galleries. The paperclip defaults do something like /:class/:style/:basename.:extension. However, with a gallery setup, I'd much rather have something like /:class/:user_name/:gallery_name/:styles/:basename.:extension. I haven't yet found a way to access variables in an object in order to dynamically create these storage locations.
Is there any way of doing this?
I've tried using #{variable} in the path, but that doesn't work. These photo objects are being created using @gallery.photos.build, so the gallery_id should already have a value that's accessible.
Take a look at the tips and updates section on Thoughtbot.com. It discusses how to add your own interpolated variables into the path/url.