简体   繁体   中英

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?

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| %>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM