# Attachment\_fu + :path\_prefix

**URL:** <https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936>\
**Category:** Rails\
**Created:** [July 30, 2009, 7:59am UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936 "2009-07-30T07:59:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [July 30, 2009, 7:59am UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936/1 "2009-07-30T07:59:38Z")

</div>

Hello friends,  
I have a query like I am using a attchment\_fu to store images.  
But the i don’t want to store to the default path let say :path\_prefix  
=\>  
‘public/uploads’ i want a dyname path for e.g :path\_prefix =\> ‘public/#{  
current\_user.id}’, So just wanted to know how can i say images to the  
dynamic location.

Regards  
Abhishek S.

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [July 30, 2009, 9:42am UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936/2 "2009-07-30T09:42:00Z")

</div>

> ‘public/uploads’ i want a dyname path for e.g :path\_prefix =\> ‘public/#{  
> current\_user.id}’,

Have you tried this like

:path\_prefix =\> “public/#{\> current\_user.id}”

```
 Instead of single quotes use double quotes

```

Sijo

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [July 30, 2009, 9:42am UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936/3 "2009-07-30T09:42:27Z")

</div>

:path\_prefix =\> “public/#{current\_user.id}”

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [July 30, 2009, 11:50am UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936/4 "2009-07-30T11:50:14Z")

</div>

Ok great things are working fine. but again i have a major concern when  
I am  
declaring it like

:path\_prefix =\> “public/user\_#{current\_user.id}”

in background it save the image in the following folder structure

“public/user\_/123/\_image.jpg”

And i am looking something like

“public/user\_123/\_image.jpg”

Actually it’s creating a just “user\_” folder which i don;t want, i want  
to  
have “user\_123”.

Thanks  
Abhis

On Thu, Jul 30, 2009 at 1:12 PM, Sijo Kg

---

<div class="post-metadata">

**Author:** ![Abhishek\_shukla](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7cd45c/32.png) [@Abhishek\_shukla](https://www.ruby-forum.com/u/Abhishek_shukla)\
**Post date:** [July 30, 2009, 1:04pm UTC](https://www.ruby-forum.com/t/attachment-fu-path-prefix/172936/5 "2009-07-30T13:04:48Z")

</div>

Give  
:storage =\> :file\_system,  
:path\_prefix =\> “public/user\_#{current\_user.id}”

Sijo
