Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails: putting class with submit_tag

I was wondering why we have to add a nil when putting :class => "class_name"

<%= submit_tag nil, :class => "class_name" %>

but for this:

<%= f.submit class: "class-Name" %>

I don't need to add the nil

Thanks

like image 518
hellomello Avatar asked Apr 03 '13 22:04

hellomello


1 Answers

     <%= submit_tag("Update", :id=>"button", :class=>"Test", :name=>"submit") %>

First parameter is required and it would be value and they any parameter you want to specify, can be done in a hash like :key=>"value".

like image 81
Mandeep Singh Avatar answered Sep 23 '22 20:09

Mandeep Singh