1

I am working on invitations per this railscast and I am using devise for authentication in my app. I would like to get this bit of code implemented:

def new
  @user = User.new(:invitation_token => params[:invitation_token])
  @user.email = @user.invitation.recipient_email if @user.invitation
end

inside of devise. This involves overriding the registrations controller. Here is the new action that is in the registrations controller:

  def new
    resource = build_resource({})
    respond_with resource
  end

I am relatively new to coding and made an attempt to sift through the devise code and figure out what's going on, but seems daunting. Is there something simple to this? How can I get that code implemented by overriding the devise registrations controller?

John
  • 13,125
  • 14
  • 52
  • 73

1 Answers1

0

He even gave an error? Another thing, you changed your routes.rb? example:

devise_for :users, :controllers => { :registrations => "registrations" }

In his method "new", add the super

def new
  @user = User.new(:invitation_token => params[:invitation_token])
  @user.email = @user.invitation.recipient_email if @user.invitation
  super
end
Tiago
  • 2,156
  • 2
  • 18
  • 27