ruby - Authlogic - NoMethodError: undefined method `[]=' for nil:NilClass -


i have simple login/logout code using authlogic gem. sometimes, i'm getting "nomethoderror: undefined method `[]=' nil:nilclass" logout code - in user_session.destroy. never managed reproduce on own, happens...

get 'logout'   user_session = usersession.find   if user_session     user_session.destroy     return {status: 200, message: 'success'}   else     return {status: 400, message: 'no session destroy'}   end end 

backtrace:

/home/admin/.rvm/gems/ruby-1.9.3-p392/gems/authlogic-3.3.0/lib/authlogic/session/session.rb:56:in update_session' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:418:inrun_509239456491140030__after_destroy_1525954531983478469_callbacks' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in __run_callback' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in_run_after_destroy_callbacks' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in run_callbacks' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/authlogic-3.3.0/lib/authlogic/session/callbacks.rb:88:inafter_destroy' /home/admin/.rvm/gems/ruby-1.9.3-p392/gems/authlogic-3.3.0/lib/authlogic/session/existence.rb:50:in `destroy'

update - usersession class implementation:

class usersession < authlogic::session::base   allow_http_basic_auth false    def remember_me_for     14.days   end    def self.last_request_at_threshold     10.minutes   end    def perishable_token_valid_for     10.minutes   end    disable_magic_states(true) end 

help please :( thanks!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -