Rails - Devise and acts_as_audited -


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

  Class ApplicationController & lt; ActionController :: Base Audit Candidate Protected DRF Current User @ User = User.Fund (user_sation) and  

I get this error.

  Stack level is very dark  

Do I need to do it differently?

Thanks

This is an old question, but still its ugly head Changes.

First of all, as the description of others, a bug occurs when deformed (formerly acts_ass_didit) is used with devise (and possibly other certification jewels), and then when you use your user model Any auditing of column devices are auditing (last_assign_in_t, final_sign_in_ip, etc.).

  • The user's sign in information for devotion (last_ign_in_at, ip, Etc.)
  • Saved as that part, the audit then tries to create an audit for that change.
  • The audit tried to set the user for that audit, to indicate who made the change, how does this happen?
  • The audited call is not yet completed with the current_user, its instrumentation method step 1 with its authentication method - stepped in the audit and is talking about it
  • Your application errors with stack level are too deep
  • @The implementation of DGM only repeats the current user method Step # 1 (Authentication_Uz! Method), creating an unlimited loop Audit to audit this change, which is for you However, in my application, I need to audit that change.

    Audited Allows you to specify a different method to use for the current_use.

    In the App Controller, refer to the current_user example variable , by adding your new method.

      def my_cool_method @current_user end  

    And then, in config / initializers / audited.rb, audit to use your new method: < With this change, the audited still will audit the change, but to set this user to audit Will not try change) - it will be zero

    Another advantage of this change on alternative solutions by DGM is that we are not overriding the current_user method of development, which is similar to the monkey patching, so this may have an unintended consequence later.


    Comments