After loading the Rails console, how should I sign in a user?

Devise provides a test helper which can be used in tests and I’ve tried to use in console:

>> include Devise::TestHelpers
>> helper.sign_in(User.first)

But I get:

NoMethodError: undefined method `env' for nil:NilClass

Anyway, I would like to use the real devise helper and not this test helper. Is there any way to achieve this?

Anonymous Asked question May 13, 2021