Class: PaperTrailManager

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/paper_trail_manager.rb,
app/helpers/paper_trail_manager/changes_helper.rb,
app/controllers/paper_trail_manager/changes_controller.rb

Defined Under Namespace

Modules: ChangesHelper Classes: ChangesController

Constant Summary collapse

@@whodunnit_name_method =
:name

Class Method Summary collapse

Class Method Details

.allow_index?(controller) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/paper_trail_manager.rb', line 44

def self.allow_index?(controller)
  allow_index_block.call controller
end

.allow_index_when(&block) ⇒ Object



40
41
42
# File 'lib/paper_trail_manager.rb', line 40

def self.allow_index_when(&block)
  self.allow_index_block = block
end

.allow_revert?(controller, version) ⇒ Boolean

Allow revert given the controller and version? If no ::allow_revert_when was specified, always return true.

Returns:

  • (Boolean)


64
65
66
# File 'lib/paper_trail_manager.rb', line 64

def self.allow_revert?(controller, version)
  allow_revert_block.call controller, version
end

.allow_revert_when(&block) ⇒ Object

Describe when to allow reverts. Call this with a block that accepts arguments for controller and version.



58
59
60
# File 'lib/paper_trail_manager.rb', line 58

def self.allow_revert_when(&block)
  self.allow_revert_block = block
end

.allow_show?(controller, version) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/paper_trail_manager.rb', line 52

def self.allow_show?(controller, version)
  allow_index_block.call controller, version
end

.allow_show_when(&block) ⇒ Object



48
49
50
# File 'lib/paper_trail_manager.rb', line 48

def self.allow_show_when(&block)
  self.allow_show_block = block
end