设计/注册中的ArgumentError#新错误的参数数量

时间:2012-10-08 04:19:56

标签: ruby-on-rails-3

我是Rails的新手。我安装了最新的Devise gem,我收到了这个错误:

ArgumentError in Devise/registrations#new

Showing /Users/Malone/Sites/todos/app/views/devise/registrations/new.html.erb where line #3 raised:
Wrong number of arguments (3 for 2)
Extracted source (around line #3):
1: <h2>Sign up</h2>
2:
3: <%= form_for(resource_name, resource,: URL => registration_path(resource_name)) do |f| %>
4: <%= f.error_messages %>
5: <p><%= f.label: email %></p>
6: <p><%= f.text_field: email %></p>

不确定您需要哪些其他信息来帮助我。但请告诉我。

2 个答案:

答案 0 :(得分:0)

更改

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

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

答案 1 :(得分:0)

解决问题请尝试此

  <h2>Sign up</h2>
  <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= f.error_messages %>
    <p><%= f.label: email %></p>
    <p><%= f.text_field: email %></p>
    ....
    ....
  <% end %>