MSRahman
MSRahman

Reputation: 79

Ruby on Rails Devise gem

I am trying to use the devise gem for my rails 3.2 project, but when I try to check for the sign_in page, I am getting the following error:

wrong number of arguments (3 for 2)

Extracted source (around line #3):

<h2>Sign in</h2>

<%= form_for(resource_name, resource, :url => session_path(resource_name)) do |f| %>
    <p><%= f.label :email %></p>
    <p><%= f.text_field :email %></p>

What exactly am I doing wrong?

Upvotes: 1

Views: 311

Answers (2)

Hesham
Hesham

Reputation: 2347

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>

Upvotes: 1

Jakub Hampl
Jakub Hampl

Reputation: 40563

You are passing a wrong number of arguments to the form_for method as it accepts only 2 arguments.

See http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for for documentation on this method.

Chances are that you should have written line 3 as:

<%= form_for(resource, :url => session_path(resource_name)) do |f| %>

Upvotes: 2

Related Questions