Devise - remember me not working? LocalHost Issue?

后端 未结 4 725
青春惊慌失措
青春惊慌失措 2020-12-17 22:11

I\'m using devise with my rails 3 app. For some reason the sign in with Remember Me is not working.

Could this be due to testing on localhost:3000 ?

in devis

4条回答
  •  眼角桃花
    2020-12-17 23:00

    This happens because remember_me comes in params as "on", but is compared to Devise::TRUE_VALUES, which are [true, 1, '1', 't', 'T', 'true', 'TRUE'].

    The easiest way is to make it work is to insure your remember_me comes as one of that values. Example of check-box(notice value="1"):

    
    

    Another way if you want to make it work with "on" value you can add "on" to Devise::TRUE_VALUES. So in your config/initializers/devise.rb just add as the first line:

    Devise::TRUE_VALUES << ["on"]
    

提交回复
热议问题