Class: PaperTrail::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_trail/rails/console.rb,
lib/paper_trail/rails/configuration.rb

Overview

module Console

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



4
5
6
7
8
9
10
11
12
# File 'lib/paper_trail/rails/configuration.rb', line 4

def initialize
  config = self

  #config.user_model = User
  config.select_user_filter = :itself
  config.select_user_inspect = :inspect
  config.select_user_other_allowed_values = ['system', 'admin']
  config.source_location_filter = ->(line) { !line.match /paper_trail/ }
end

Instance Attribute Details

#select_user_filterObject

Filter proc to use to show a list of users in select_user helper. For example:

->(users) { users.admins.default_order }

or

->(users) { users.none }

Can be also be a symbol or anything that responds to to_proc.



19
20
21
# File 'lib/paper_trail/rails/configuration.rb', line 19

def select_user_filter
  @select_user_filter
end

#select_user_inspectObject

Returns the value of attribute select_user_inspect.



21
22
23
# File 'lib/paper_trail/rails/configuration.rb', line 21

def select_user_inspect
  @select_user_inspect
end

#select_user_other_allowed_valuesObject

Returns the value of attribute select_user_other_allowed_values.



23
24
25
# File 'lib/paper_trail/rails/configuration.rb', line 23

def select_user_other_allowed_values
  @select_user_other_allowed_values
end

#source_location_filterObject

Returns the value of attribute source_location_filter.



25
26
27
# File 'lib/paper_trail/rails/configuration.rb', line 25

def source_location_filter
  @source_location_filter
end

Instance Method Details

#consoleObject



48
49
50
# File 'lib/paper_trail/rails/console.rb', line 48

def console
  @console ||= Console::Configuration.new
end