probleme with image_tag

5 views
Skip to first unread message

Adel Mediouni

unread,
Jun 20, 2011, 2:44:57 PM6/20/11
to Ruby on Rails: Talk
hi,
i want to display a image in the view:
<%= image_tag("#{RAILS_ROOT}/public/images/freinds/
user"+@users['id'].to_s+".png") %>
in the view i just see a small square to mark to place pf the
image,but the pic dont display.
when i follow the url of the pic i have this:
http://localhost:3000/home/delmed/servadmin/public/images/freinds/user3.png
and it say: No route matches "/home/delmed/servadmin/public/images/
freinds/user3.png"
the pic exesit in the folder.
what can i do please.
thanks.

Tim Shaffer

unread,
Jun 20, 2011, 2:49:24 PM6/20/11
to rubyonra...@googlegroups.com
If your image is in the images folder under your public folder, you don't need to include anything before the "images/" part of the URL. So you can just do this:

<%= image_tag("freinds/user" + @users['id'].to_s + ".png") %>

Also, you have "friends" spelled incorrectly. Not sure if that's intentional or not.

Adel Mediouni

unread,
Jun 20, 2011, 2:54:56 PM6/20/11
to Ruby on Rails: Talk
thanks man,you realy help me :)
for the freinds,its a mistake, i always write it like this :$
:)
Reply all
Reply to author
Forward
0 new messages