ruby-on-railsdevisefaye

Unable to use current_user.id in faye extension


I am using devise and faye. and I want to track all online users. so i thought of including a faye extension. in faye/faye_current_user.rb . when i am using current_user.id in faye_current_user.rb it is throwing undefined variable error.

If you have anyother easy way to fetch online users please help me out.


Solution

  • The problem is that the "current_user" method from devise isn't being called before your method inside of faye_current_user.rb.

    A working solution is dependent upon the where this file is located and how your set current_user before calling the methods within that file.