vendredi 30 octobre 2015

current_user method with devise from the console

rails 3.2.18
devise

I started up the rails console:

rails c

Then I logged in:

[17] pry(main)> ApplicationController.allow_forgery_protection = false
=> false
[18] pry(main)> app.post('/sign_in', {"user"=>{"login"=>"somemail@gmail.com", "password"=>"xxxxxxx"}})
=> 302

At this point, shouldn't the current_user method work? When I do:

current_user.id

I get:

NameError: undefined local variable or method `current_user' for main:Object

Aucun commentaire:

Enregistrer un commentaire