skip to Main Content

I am using devise with twitter-bootstrap-rails, but i got the error on form_for, any file i didn’t include?

undefined local variable or method `html' for #<#<Class:0x007fc07b544410>:0x007fc0810b8b70>

Here is the code:

 <%= menu_group pull: :right do %>
                <% if current_user %>
                    <%= menu_item "Log Out", destroy_user_session_path, :method => :delete%>
                <% else %>
                    <!-- error here-->
                    <%= form_for @user, url: user_session_path(:user), html => {class: "navbar-form pull-right"} do |f| -%>
                      <p><%= f.text_field :email %></p>
                      <p><%= f.password_field :password %></p>
                      <p><%= f.submit "Sign in" %></p>
                    <% end -%>
                <% end %>
            <% end %>

EDIT: synax error, just copied from



  1. You are missing a colon(:). It should be :html => or html:

    <%= form_for @user, url: user_session_path(:user), :html => {class: "navbar-form pull-right"} do |f| -%>
    Login or Signup to reply.
  2. It’s a syntax error. Do Ctrl+F to find the only occurrence of “html”, and then consider why it may be failing.

    :html =>



    will be your fix.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top