0
button_to 'Submit',url(:account, :login) 

generates form like this:

<form action="/account/login" method="post">
    <input type="submit" value="Submit">
</form>

but I want to generate something like this:

<form action="/account/login" method="post">
    <input type="submit" value="Submit" class="myclass">
</form>
Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
killebytes
  • 940
  • 1
  • 10
  • 24

2 Answers2

2

Many of tag helpers can receive a block to capture inner html:

button_to 'Submit', url(:base, :index) do
  submit_tag 'Submit', :class => 'myclass'
end
ujifgc
  • 2,215
  • 2
  • 19
  • 21
0

I believe that this should work:

<%= button_to 'Submit', {:controller => :account, :action => :login}, :class => 'myform' %>

The third parameter to button_to is html_options. If you can only alter the form using the html_options, then you could use a css selector like this:

form.myform input {} 
Michael Frederick
  • 16,664
  • 3
  • 43
  • 58