How to manually create a new user and user session in Devise?

You can create a new Devise user simply by creating a new user model (see https://github.com/plataformatec/devise/wiki/How-To:-Manage-users-through-a-CRUD-interface)

@user = User.new(:email => 'test@example.com', :password => 'password', :password_confirmation => 'password')
@user.save

To sign in your newly created user, use sign_in @user

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)