Button_on with css style

Hi all,

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:

I wonder if there is any better way to do it and to set a css style to
my button.

Thanks for any help or hint
-Andreas

Andreas S. wrote:

Hi all,

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:

I wonder if there is any better way to do it and to set a css style to
my button.

Thanks for any help or hint
-Andreas

I’m not an HTML or CSS jock, but remember this…you’re not required to
use the Rails helpers in your rhtml files. Use whatever works the best.
If that is straight ahead html, then there’s nothing wrong with that.
Use the helper only if it “helps”.

jp

Andreas S. wrote:

/>
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’
%>


We develop, watch us RoR, in numbers too big to ignore.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs