Reputation: 6244
I am using devise in a rails 3 app. I am giving some users the ability to register other users. These registrations will simply add a new record with id and email to the users table. My routes contain the standard devise items.
In my invitations controller:
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
The view has a list of people already invited and then a form to add a new user. I am using the code from the devise registration form. Perhaps i don't need to do this? The following line in new.html.erb creates an error:
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
The error:
undefined local variable or method `resource' for #<#<Class:0x103655be0>:0x1036537f0>
Thanks!
Upvotes: 1
Views: 5032
Reputation: 6948
Did you inherit your registrations controller from Devise's registrations controller?
Upvotes: 1
Reputation: 6244
I got past this error with the following:
<% form_for :user, :url => create_invitation_invitations_path(@user) do |f| %>
We'll see if i run into other complications.
UPDATE: no complications.
Upvotes: 0