Sunday, December 16, 2012

[Rails] Re: Question: image_tag(source, options = {})

Use the options directly in image tag as how you use in html tag,but
little convertion has to be done for Rails code, it will work

HTML : <img alt="logo" src="logo.png" align="right"
style="background-color:#288AC6; padding:10px;" class="classname"
id="idname" />

RAILS : <%= image_tag('logo.png', :alt=>'logo',:align=>'right'
,:style=>'background-color:##288AC6; padding:10px;' ,:class=>"classname"
, :id=>"idname") %>

Just make the attribute name in HTML as symbols followed by a value
as a key value pair

align = "left" HTML
:align => "left" RAILS

-Karthikeyan
Railsfactory

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate