Module: PaperTrail
- Defined in:
- lib/paper_trail.rb,
lib/paper_trail/config.rb,
lib/paper_trail/controller.rb,
lib/paper_trail/version_number.rb,
lib/paper_trail/has_paper_trail.rb,
lib/generators/paper_trail/install_generator.rb
Overview
PaperTrail’s module methods can be called in both models and controllers.
Defined Under Namespace
Modules: Controller, Model Classes: Config, InstallGenerator
Constant Summary collapse
- VERSION =
'2.3.3'
Class Method Summary collapse
-
.controller_info ⇒ Object
Returns any information from the controller that you want PaperTrail to store.
-
.controller_info=(value) ⇒ Object
Sets any information from the controller that you want PaperTrail to store.
-
.enabled=(value) ⇒ Object
Switches PaperTrail on or off.
-
.enabled? ⇒ Boolean
Returns ‘true` if PaperTrail is on, `false` otherwise.
-
.enabled_for_controller=(value) ⇒ Object
Sets whether PaperTrail is enabled or disabled for the current request.
-
.enabled_for_controller? ⇒ Boolean
Returns ‘true` if PaperTrail is enabled for the request, `false` otherwise.
-
.whodunnit ⇒ Object
Returns who is reponsible for any changes that occur.
-
.whodunnit=(value) ⇒ Object
Sets who is responsible for any changes that occur.
Class Method Details
.controller_info ⇒ Object
Returns any information from the controller that you want PaperTrail to store.
See ‘PaperTrail::Controller#info_for_paper_trail`.
52 53 54 |
# File 'lib/paper_trail.rb', line 52 def self.controller_info paper_trail_store[:controller_info] end |
.controller_info=(value) ⇒ Object
Sets any information from the controller that you want PaperTrail to store. By default this is set automatically by a before filter.
58 59 60 |
# File 'lib/paper_trail.rb', line 58 def self.controller_info=(value) paper_trail_store[:controller_info] = value end |
.enabled=(value) ⇒ Object
Switches PaperTrail on or off.
13 14 15 |
# File 'lib/paper_trail.rb', line 13 def self.enabled=(value) PaperTrail.config.enabled = value end |
.enabled? ⇒ Boolean
Returns ‘true` if PaperTrail is on, `false` otherwise. PaperTrail is enabled by default.
19 20 21 |
# File 'lib/paper_trail.rb', line 19 def self.enabled? !!PaperTrail.config.enabled end |
.enabled_for_controller=(value) ⇒ Object
Sets whether PaperTrail is enabled or disabled for the current request.
31 32 33 |
# File 'lib/paper_trail.rb', line 31 def self.enabled_for_controller=(value) paper_trail_store[:request_enabled_for_controller] = value end |
.enabled_for_controller? ⇒ Boolean
Returns ‘true` if PaperTrail is enabled for the request, `false` otherwise.
See ‘PaperTrail::Controller#paper_trail_enabled_for_controller`.
26 27 28 |
# File 'lib/paper_trail.rb', line 26 def self.enabled_for_controller? !!paper_trail_store[:request_enabled_for_controller] end |
.whodunnit ⇒ Object
Returns who is reponsible for any changes that occur.
36 37 38 |
# File 'lib/paper_trail.rb', line 36 def self.whodunnit paper_trail_store[:whodunnit] end |
.whodunnit=(value) ⇒ Object
Sets who is responsible for any changes that occur. You would normally use this in a migration or on the console, when working with models directly. In a controller it is set automatically to the ‘current_user`.
44 45 46 |
# File 'lib/paper_trail.rb', line 44 def self.whodunnit=(value) paper_trail_store[:whodunnit] = value end |