I need to add a class attribute to the elements generated by link_to
for my CSS to style the links.
How can I do that?
<%= link_to “Artworks”, :controller => “artwork”, :action => “list” %>
I need to add a class attribute to the elements generated by link_to
for my CSS to style the links.
How can I do that?
<%= link_to “Artworks”, :controller => “artwork”, :action => “list” %>
dangerwillrobinsondanger wrote:
I need to add a class attribute to the elements generated by link_to
for my CSS to style the links.
How can I do that?<%= link_to “Artworks”, :controller => “artwork”, :action => “list” %>
<%= link_to ‘My Homepage’, get_home_page.last, :class => ‘navlink3’ %>
–
Phlip
Test Driven Ajax (on Rails) [Book]
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax
Thanks, but that approach using this:
<%= link_to “Artworks”, :controller => “artwork”, :action =>
“list”, :class => “artwork” %>
…generates this:
That definitely renders, but renders something different from what I
need.
I need to generate this:
Artworks
Aha!! I got it!
<%= link_to “Artworks”, :controller => “artwork”, :action =>
“list”, :class => “artwork” %>
needs to be:
<%= link_to “Artworks”, {:controller => “artwork”, :action =>
“list”}, :class => “artwork” %>
Voila!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs