【发布时间】:2011-05-20 13:09:24
【问题描述】:
我在 rails 3 应用程序中使用设计。我让一些用户能够注册其他用户。这些注册将简单地将带有 id 和电子邮件的新记录添加到 users 表中。我的路线包含标准设计项目。
在我的邀请控制器中:
def new
@invitations = blah blah # creates a list of people already invited
@user = User.new # for the person begin invited
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @invitations }
end
end
该视图有一个已受邀人员的列表,然后是一个用于添加新用户的表单。我正在使用设计注册表单中的代码。也许我不需要这样做? new.html.erb 中的以下行会产生错误:
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
错误:
undefined local variable or method `resource' for #<#<Class:0x103655be0>:0x1036537f0>
谢谢!
【问题讨论】: