views:

36

answers:

1

By default, rails is looking for images to "public/images" folder.

But it is not suiteable for me, since i have all the multimedia stuff in "public/data/:model/:id" folders.

How do i force rails to look into this folder.

I don't need obligatory such a pattern, that i mentioned above. The only thing, i need, is just to change "public/images" path to "public/data", so, the rails should look to "data" folder, instead of "images".

I don't need to use "paperclip" plugin, because my models holding the pure HTML content (with clean and simple structure, that will not change in the future), that has "img" tags.

How can it be done ?

+1  A: 

You you mean the image_tag helper is looking by default there? That's only the case if you only specify a relative path. Putting the full path in gets what you want I believe.

<%= image_tag '/data/model/1'

would generate

<img src="/data/model/1.png">
bjg
No, this is not, what i want.My model has HTML content, that user can create. For example: "comment.content" will hold HTML (with "p", "div", "img" tags). It will be displayed as is. The only thing, that will be altered before displaying - is translating the local URL's to global. E.g. "my_img.png" will be translated to "public/data/comments/123/my_img.png".
AntonAL
OK I see. Then I think what you need to do is prefix your `content` image path with `/data/comments/123` (using your example) before rendering and that will mean the image will be fetched from `/public/data/...` instead of the default
bjg
Thanks, it works. I missed the "/" character in URLs beginning. That was a reason of the problem. Now, i don't need any tweaks, because Rails is smart :)
AntonAL