0

I just inherited a rails project using devise. In production you can send a user a invitation with an invitation token. Does devise have a way to set up a dummy invitation token? In other words is there known way to deal with all of devises different authentication systems in a dev environment?

Thanks

2
  • You can could create a user manually in the rails console Commented Oct 8, 2013 at 15:09
  • You can create a user from the console: stackoverflow.com/questions/4316940/… or you can use the registration form and the confirmation mail will be displayed in the debug output of your rails development server. Commented Oct 8, 2013 at 15:16

1 Answer 1

2

In my development environment I turn email off. Then create new users, whether invitation guest users or standard users with the form - then check my logs for the email sent to user and grab the invitation link.

in `config/environments/development.rb' change:

 config.action_mailer.delivery_method = :smtp

to

config.action_mailer.delivery_method = :false

Then you can grab the email body from the logs and use the link.

You can always change the token if you need to.

User.resend_invitation!(:email => "[email protected]")

You can also work it from the command line side:

User.invite!(:email => "[email protected]", :name => "Joe Blow")

To skip the user email you can do:

User.invite!(:email => "[email protected]", :name => "Joe Blow") { |user| user.skip_invitation => true }

And to accept it from the command line:

u = User.find_by_email("[email protected]")
User.accept_invitation!(:invitation_token => u.invitation_token, :password => "ad97nwj3o2")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.