Sha256: df65950a5fc92e795a7fa44599da8034852a5b2d2573ce79a34132a998e3ffb1

Contents?: true

Size: 362 Bytes

Versions: 7

Compression:

Stored size: 362 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(: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

7 entries across 7 versions & 2 rubygems

Version Path
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/acts_as_audited-2.1.0/lib/acts_as_audited/audit_sweeper.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/acts_as_audited-2.1.0/lib/acts_as_audited/audit_sweeper.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/acts_as_audited-2.1.0/lib/acts_as_audited/audit_sweeper.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/acts_as_audited-2.1.0/lib/acts_as_audited/audit_sweeper.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/acts_as_audited-2.1.0/lib/acts_as_audited/audit_sweeper.rb
acts_as_audited-2.1.0 lib/acts_as_audited/audit_sweeper.rb
acts_as_audited-2.0.0 lib/acts_as_audited/audit_sweeper.rb