开发者

Rails - How to Move a PaperClip Model to Another Model

开发者 https://www.devze.com 2023-02-08 08:32 出处:网络
Rails 3 app with paperclip. Given a Paperclip File Model, how can you move that paperclip File to different paperclip, 开发者_运维百科say image gallery? Which would have different processing rules et

Rails 3 app with paperclip.

Given a Paperclip File Model, how can you move that paperclip File to different paperclip, 开发者_运维百科say image gallery? Which would have different processing rules etc?

Any ideas?


I've just tried the following:

Given two models, with a picture attachment and their own Paperclip configurations, say: Gallery1 and Gallery2.

Given I had one object in Gallery1 with a picture already attached.

Make:

Gallery2.create(:picture => Gallery1.first.picture)

And it creates the picture properly resized with the constraints of Gallery2.

0

精彩评论

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