开发者

Paperclip - how to set up the path?

I am already a long time struggling with setting a path for storing an images. I would like to have a path in a shape:

public/photos/88/small/image.jpg

public/photos/88/medium/image.jpg

public/photos/88/original/image.jpg

The number 88 is ID of image gallery. I tried to check some tutorials on google, but I can't find the right way, how to set it.

I am trying in my Photo model:

  has_attached_file :photo,
                    :styles => {:small=> "65x65#",
                                :medium  => "500x500>" },
                    :url => "/public/photos/:开发者_开发百科album_id/:style_:basename.:extension"

So my first problem is, I don't know, how to get to Photo model the value of album_id, and the second one, how to distinguish the directories for small, medium and original size of image...

Can anyone help me, please, how the path set up?

Thank you so much in advance


http://robots.thoughtbot.com/post/159807063/paperclip-tips-and-updates

And don't forget restart your server! (my problem)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜