Skip to content

How To: Sign in from a controller

Eugene Burmakin edited this page Jan 1, 2017 · 2 revisions

Often (like, when creating users as part of another controllers create method) you want to sign in the user from a controller. This is how it is accomplished:

sign_in(User.find(params[:id]), scope: :user)

Of course you could also just pass in a predefined User object.

Clone this wiki locally