views:

12

answers:

0

Hello,

I'd like my model's has_attached_file setting for paperclip to have a path as follows:

:path => "/:attachment/:instance_id/:id/:style/:basename.:extension",

so I setup a Paperclip.interpolates to obtain (:instance_id)

Paperclip.interpolates :instance_id do |attachment, style|

  def user_id(attachment, style)
    attachment.current_user.instance_id
  end

end

current_used is from Devise...

But I'm getting the following error:

undefined method `current_user' for #<Paperclip::Attachment:0x1089b6488>