Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a custom class for form_for in Ruby on rails [duplicate]

I am trying out development on Ruby on Rails and I am creating a form using form_for helper:

 <%= form_for(:session, url: login_path) , :html => {:class => "formsignin"} do |f| %>

I am trying to add my own custom class formsignin but this does not work.

like image 551
user1692342 Avatar asked Sep 11 '15 23:09

user1692342


1 Answers

:html option is an argument to form_for helper, you've closed form_for method call too early! Reference documentation for form_for.

Try the following:

<%= form_for(:session, url: login_path, html: {class: "formsignin"}) do |f| %>
like image 135
vee Avatar answered Nov 04 '22 19:11

vee