Dynamic path to store images using attachment_fu

Hello friends,

I need to store the images of user into there own directory for e.g “public/uploads/user_(user_id)”
So I am declaring it inside the model.

has_attachment :path_prefix => ‘public/uploads/user_#{current_user}’

As current user is not accessible from model. So in this case how can i save the images into the user directory?

Please help me with this situation.

Regards
Abhi

Abhishek shukla wrote:

Hello friends,

I need to store the images of user into there own directory for e.g
"public/uploads/user_(user_id)"
So I am declaring it inside the model.

has_attachment :path_prefix => 'public/uploads/user_#{current_user}'

As current user is not accessible from model. So in this case how can i
save
the images into the user directory?

Please help me with this situation.

Regards
Abhi

If user got any unique ID and if you are using login,then you can access
user id from session....or you can create a session for each user and
access it from there..
Thank you..