Sha256: a21bd6652d721fc65115596532ae2ad10c3db5ad4685f63188f9a831b65f2cc8

Contents?: true

Size: 980 Bytes

Versions: 10

Compression:

Stored size: 980 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery

  # Rails 5 deprecates `before_filter`
  name_of_before_callback = respond_to?(:before_action) ? :before_action : :before_filter

  # Some applications and libraries modify `current_user`. Their changes need
  # to be reflected in `whodunnit`, so the `set_paper_trail_whodunnit` below
  # must happen after this.
  send(name_of_before_callback, :modify_current_user)

  # Going forward, we'll no longer add this `before_filter`, requiring people
  # to do so themselves, allowing them to control the order in which this filter
  # happens.
  send(name_of_before_callback, :set_paper_trail_whodunnit)

  def rescue_action(e)
    raise e
  end

  # Returns id of hypothetical current user
  attr_reader :current_user

  def info_for_paper_trail
    { ip: request.remote_ip, user_agent: request.user_agent }
  end

  private

  def modify_current_user
    @current_user = OpenStruct.new(id: 153)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paper_trail-5.2.3/test/dummy/app/controllers/application_controller.rb
paper_trail-6.0.0 test/dummy/app/controllers/application_controller.rb
paper_trail-5.2.3 test/dummy/app/controllers/application_controller.rb
paper_trail-5.2.2 test/dummy/app/controllers/application_controller.rb
paper_trail-5.2.1 test/dummy/app/controllers/application_controller.rb
paper_trail-5.2.0 test/dummy/app/controllers/application_controller.rb
paper_trail-5.1.1 test/dummy/app/controllers/application_controller.rb
paper_trail-5.1.0 test/dummy/app/controllers/application_controller.rb
paper_trail-5.0.1 test/dummy/app/controllers/application_controller.rb
paper_trail-5.0.0 test/dummy/app/controllers/application_controller.rb