button_on with css style

Andreas Schneider wrote:

I am new to ruby/rails and want to use a normal button - not a submit button - as a link. But I also want to use a css style on that button.

My idea was this: <%= button_to "Add New Client", :action => 'new', :class => 'button' %> where "button" is my css style

this will result into: <form method="post" action="/client/new?class=button" class="button-to"><div><input type="submit" value="Add New Client" /></div></form>

You need to add some curly braces to separate the url and options hashes, otherwise Ruby treats the list of key-values as all part of the url hash.

<%= button_to "Add New Client", {:action => 'new'}, :class => 'button' %>