How can i get image-path on with haml [rails 4]

3,304 views
Skip to first unread message

Ero s

unread,
Sep 30, 2013, 10:20:19 AM9/30/13
to ha...@googlegroups.com
Hello guys!
 So this is my first post here, and i was started to use haml/sass with ROR recently
i'm trying to put images on my view using this haml code:

[code]
.mydivclass
  = image_tag 'simon.png', alt: 'My Image', size: '153x110'
[/code]

so in my chrome dev tools i see:

<img alt="My Image" height="110" src="http://my-ip:3000/images/simon.png" width="153">

but don't load the image,

the path of images on my project is, 

project/project_name/app/assets/images

someone can help me about this?

Les Nightingill

unread,
Sep 30, 2013, 3:40:24 PM9/30/13
to ha...@googlegroups.com
There's a rails helper that'll do it for you... asset_path... so ...

=image_tag asset_path('simon.png'), :size => '153x110'


--
You received this message because you are subscribed to the Google Groups "Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haml+uns...@googlegroups.com.
To post to this group, send email to ha...@googlegroups.com.
Visit this group at http://groups.google.com/group/haml.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages