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.(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))).chomp
Class Method Summary collapse
-
.disable ⇒ Object
Disable the approval queue at a global level.
-
.enable ⇒ Object
Enable the approval queue at a global level.
-
.enabled? ⇒ Boolean
Returns true if the approval queue is enabled globally.
-
.owner_class ⇒ Object
Get the referenced Owner class to be used by generic finders.
-
.owner_class=(klass) ⇒ Object
Set the referenced Owner class to be used by generic finders.
-
.owner_source ⇒ Object
Get the class used for overriding Ownership retrieval.
-
.owner_source=(source) ⇒ Object
Set the class used for overriding Ownership retrieval.
-
.stale_check=(bool) ⇒ Object
Enable or disable the stale record check when approving updates.
-
.stale_check? ⇒ Boolean
Get the state of the stale check.
-
.view_language ⇒ Object
Get the engine used for rendering view files.
-
.view_language=(lang) ⇒ Object
Set the engine used for rendering view files.
Class Method Details
.disable ⇒ Object
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 |
.enable ⇒ Object
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.
34 35 36 37 |
# File 'lib/acts_as_approvable.rb', line 34 def self.enabled? @enabled = true if @enabled.nil? @enabled end |
.owner_class ⇒ Object
Get the referenced Owner class to be used by generic finders.
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.
43 44 45 |
# File 'lib/acts_as_approvable.rb', line 43 def self.owner_class=(klass) @owner_class = klass end |
.owner_source ⇒ Object
Get the class used for overriding Ownership retrieval
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
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.
95 96 97 |
# File 'lib/acts_as_approvable.rb', line 95 def self.stale_check? @stale_check || true end |
.view_language ⇒ Object
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 |