Class: PaperTrail::Rails::Console::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/paper_trail/rails/console.rb', line 11

def initialize
  config = self

  config.ask_for_user      = true
  config.require_user      = false
  config.auto_reset_user   = false

  config.ask_for_reason    = true
  config.require_reason    = false
  config.auto_reset_reason = true

  config.user_for_test = ->(users) {
    users.last
  }
end

Instance Attribute Details

#ask_for_reasonObject

Returns the value of attribute ask_for_reason.



31
32
33
# File 'lib/paper_trail/rails/console.rb', line 31

def ask_for_reason
  @ask_for_reason
end

#ask_for_userObject

Returns the value of attribute ask_for_user.



27
28
29
# File 'lib/paper_trail/rails/console.rb', line 27

def ask_for_user
  @ask_for_user
end

#auto_reset_reasonObject

Returns the value of attribute auto_reset_reason.



33
34
35
# File 'lib/paper_trail/rails/console.rb', line 33

def auto_reset_reason
  @auto_reset_reason
end

#auto_reset_userObject

Returns the value of attribute auto_reset_user.



29
30
31
# File 'lib/paper_trail/rails/console.rb', line 29

def auto_reset_user
  @auto_reset_user
end

#require_reasonObject

Returns the value of attribute require_reason.



32
33
34
# File 'lib/paper_trail/rails/console.rb', line 32

def require_reason
  @require_reason
end

#require_userObject

Returns the value of attribute require_user.



28
29
30
# File 'lib/paper_trail/rails/console.rb', line 28

def require_user
  @require_user
end

#user_for_testObject

A proc that returns a user if you ever run ‘rails console` in test environment (where you probably won’t have any real data)



37
38
39
# File 'lib/paper_trail/rails/console.rb', line 37

def user_for_test
  @user_for_test
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



40
41
42
# File 'lib/paper_trail/rails/console.rb', line 40

def configure
  yield self
end