Rails link_to with inline styling

Marco picture Marco · Mar 19, 2012 · Viewed 60.7k times · Source

I must change a link_to tag color without using a CSS class, how can I do? I've tried something such as

<%= link_to item.description, {}, {:style=>'color:#FFFFFF;', :class => "css_class"} %>

but it doesn't works on ruby 1.9.2 and rails 3.1

Answer

ksol picture ksol · Mar 19, 2012

How about

<%= link_to item.description, nil, {:style=>'color:#FFFFFF;', :class => "css_class"} %>

...or...

<%= link_to item.description, '#', {:style=>'color:#FFFFFF;', :class => "css_class"} %>