ruby on rails 3 - current_user method with devise from the console -
rails 3.2.18 devise pry-rails gem (which installs pry) pry-doc gem
i started rails console:
rails c
then logged in:
then logged in:
[13] pry(main)> applicationcontroller.allow_forgery_protection = false => false [14] pry(main)> app.post('/sign_in', {"user"=>{"login"=>"p3.rails.production@gmail.com", "password"=>"vw#98052"}}) => 302
302 means logged in, means can call:
[15] pry(main)> app.controller.current_user
but getting following response:
nomethoderror: undefined method `current_user' #<devise::failureapp:0x000000094e33c0> (pry):13:in `__pry__' [16] pry(main)> app.session
gives me:
=> {"flash"=> #<actiondispatch::flash::flashhash:0x00000009509598 @closed=false, @flashes={:alert=>"you need sign in or sign before continuing."}, @now=nil, @used=#<set: {}>>}
Comments
Post a Comment