Paperclip attachments with dynamic style sizes from Model

前端 未结 2 1725
迷失自我
迷失自我 2021-01-01 04:29

Using Rails 2, I try to separate different, dynamic image sizes trough another Model from the Paperclip-Model. My current approach, using a Proc, looks the following:

<
2条回答
  •  失恋的感觉
    2021-01-01 04:45

    The solution is simple. instance in my first example Proc is an instance of Paperclip::Attachment. As I want to call a File method, one has to get the calling instance inside the Proc:

    Proc.new { |clip| clip.instance.attachment_sizes }
    

    instance represents File-instance in the given example.

提交回复
热议问题