Rails - Add style/image to button_to
css, ruby-on-rails, stylesheet
Solution
Since you're using an image, there is no reason to use `button_to` instead of `link_to`, "button look" will be lost to the user. You can create an image with a link like so:
<%= link_to image_tag("rails.png"), {:controller => 'foo', :action => "bar" } %>
If, for some reason, you need to use button_to, you can give it a CSS class and apply some styles via that:
<%= button_to "Show Me", {:controller => 'personal', :action => "add" }, {:class => "buttonTo" } %>
Problem
I'm developing in rails right now and I was wondering if there are any easy ways to add some style to the button_to control. Can you add styling to the ``` <%= submit_tag 'Log in' %> ``` or ``` <%= button_to "Show Me", {:controller => 'personal', :action => "add" } %> ``` It would be great to change the color....But brownie point if someone can tell me how to make it an image