Module: ActsAsApprovable

Defined in:
lib/acts_as_approvable.rb,
lib/acts_as_approvable/error.rb,
lib/acts_as_approvable/model.rb,
lib/acts_as_approvable/railtie.rb,
lib/acts_as_approvable/version.rb,
lib/acts_as_approvable/ownership.rb,
lib/generators/acts_as_approvable/base.rb,
lib/acts_as_approvable/model/class_methods.rb,
lib/acts_as_approvable/model/instance_methods.rb,
lib/acts_as_approvable/model/create_instance_methods.rb,
lib/acts_as_approvable/model/update_instance_methods.rb,
lib/acts_as_approvable/model/destroy_instance_methods.rb

Defined Under Namespace

Modules: Generators, Model, Ownership Classes: Error, Railtie

Constant Summary collapse

VERSION =
File.read(File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))).chomp

Class Method Summary collapse

Class Method Details

.disableObject

Disable the approval queue at a global level.



28
29
30
# File 'lib/acts_as_approvable.rb', line 28

def self.disable
  @enabled = false
end

.enableObject

Enable the approval queue at a global level.



22
23
24
# File 'lib/acts_as_approvable.rb', line 22

def self.enable
  @enabled = true
end

.enabled?Boolean

Returns true if the approval queue is enabled globally.

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/acts_as_approvable.rb', line 34

def self.enabled?
  @enabled = true if @enabled.nil?
  @enabled
end

.owner_classObject

Get the referenced Owner class to be used by generic finders.

See Also:



51
52
53
# File 'lib/acts_as_approvable.rb', line 51

def self.owner_class
  @owner_class
end

.owner_class=(klass) ⇒ Object

Set the referenced Owner class to be used by generic finders.

See Also:



43
44
45
# File 'lib/acts_as_approvable.rb', line 43

def self.owner_class=(klass)
  @owner_class = klass
end

.owner_sourceObject

Get the class used for overriding Ownership retrieval

See Also:



67
68
69
# File 'lib/acts_as_approvable.rb', line 67

def self.owner_source
  @owner_source
end

.owner_source=(source) ⇒ Object

Set the class used for overriding Ownership retrieval

See Also:



59
60
61
# File 'lib/acts_as_approvable.rb', line 59

def self.owner_source=(source)
  @owner_source = source
end

.stale_check=(bool) ⇒ Object

Enable or disable the stale record check when approving updates.



89
90
91
# File 'lib/acts_as_approvable.rb', line 89

def self.stale_check=(bool)
  @stale_check = !!bool
end

.stale_check?Boolean

Get the state of the stale check.

Returns:

  • (Boolean)


95
96
97
# File 'lib/acts_as_approvable.rb', line 95

def self.stale_check?
  @stale_check || true
end

.view_languageObject

Get the engine used for rendering view files. Defaults to ‘erb’



79
80
81
82
83
84
85
# File 'lib/acts_as_approvable.rb', line 79

def self.view_language
  if Rails.version =~ /^3\./
    Rails.configuration.generators.rails[:template_engine].try(:to_s) || 'erb'
  else
    @lang || 'erb'
  end
end

.view_language=(lang) ⇒ Object

Set the engine used for rendering view files.



73
74
75
# File 'lib/acts_as_approvable.rb', line 73

def self.view_language=(lang)
  @lang = lang
end