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>

不确定您还需要哪些其他信息来帮助我。但是让我知道。

4

2 回答 2

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| %>
于 2012-10-08T04:23:04.010 回答
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 %>
于 2012-10-08T04:59:07.917 回答