Skip to content

How To: Sign in from a controller

betternow edited this page · 1 revision
Clone this wiki locally

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, User.find(params[:id]))

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

Something went wrong with that request. Please try again.