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/version.rb,
lib/acts_as_approvable/railtie.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

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.



33
34
35
# File 'lib/acts-as-approvable.rb', line 33

def self.disable
  @enabled = false
end

.enableObject

Enable the approval queue at a global level.



27
28
29
# File 'lib/acts-as-approvable.rb', line 27

def self.enable
  @enabled = true
end

.enabled?Boolean

Returns true if the approval queue is enabled globally.

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/acts-as-approvable.rb', line 39

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:



56
57
58
# File 'lib/acts-as-approvable.rb', line 56

def self.owner_class
  @owner_class
end

.owner_class=(klass) ⇒ Object

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

See Also:



48
49
50
# File 'lib/acts-as-approvable.rb', line 48

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

.owner_sourceObject

Get the class used for overriding Ownership retrieval

See Also:



72
73
74
# File 'lib/acts-as-approvable.rb', line 72

def self.owner_source
  @owner_source
end

.owner_source=(source) ⇒ Object

Set the class used for overriding Ownership retrieval

See Also:



64
65
66
# File 'lib/acts-as-approvable.rb', line 64

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

.view_languageObject

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



84
85
86
87
88
89
90
# File 'lib/acts-as-approvable.rb', line 84

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.



78
79
80
# File 'lib/acts-as-approvable.rb', line 78

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