Search code examples
ruby-on-railsdeviseacts-as-audited

Rails - Devise and acts_as_audited


Hey, I want to use Devise and acts_as_audited together but when I try and link them using -

class ApplicationController < ActionController::Base
 audit Candidate
 protected

 def current_user
   @user = User.find(user_session)    
 end

I get this error.

stack level too deep

Do I need to do it differently ?

Thanks


Solution

  • Just to close this off.

    stack level too deep is caused because devise has built in auditing on the current_user variable.

    So every time you access the variable it causes an infinite loop.