Sha256: 9babcd47d57a9208263411f61f97001b8bbc118b48fa639488977d3591dca96b

Contents?: true

Size: 369 Bytes

Versions: 4

Compression:

Stored size: 369 Bytes

Contents

# @private
class AuditSweeper < ActionController::Caching::Sweeper
  observe Audit

  def before_create(audit)
    audit.user ||= current_user
    audit.remote_address = controller.try(:request).try(:remote_ip)
  end

  def current_user
    controller.send ActsAsAudited.current_user_method if controller.respond_to?(ActsAsAudited.current_user_method, true)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
acts_as_audited-2.0.0.rc7 lib/acts_as_audited/audit_sweeper.rb
acts_as_audited-2.0.0.rc6 lib/acts_as_audited/audit_sweeper.rb
acts_as_audited-2.0.0.rc5 lib/acts_as_audited/audit_sweeper.rb
acts_as_audited-2.0.0.rc4 lib/acts_as_audited/audit_sweeper.rb