Sha256: bcdbe146988a2d688afb4fb4a1ecfca40f3a883e247b776fa461853bef6368f4

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

require 'active_record'


$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'acts_as_approvable/acts_as_approvable'
require 'acts_as_approvable/approval'
require 'acts_as_approvable/error'
require 'acts_as_approvable/ownership'
require 'acts-as-approvable/version'

if defined?(Rails) && Rails.version =~ /^3\./
  require 'acts_as_approvable/railtie'
elsif defined?(ActiveRecord)
  ActiveRecord::Base.send :include, ActsAsApprovable::Model
end

$LOAD_PATH.shift

module ActsAsApprovable
  ##
  # Enable the approval queue at a global level.
  def self.enable
    @enabled = true
  end

  ##
  # Disable the approval queue at a global level.
  def self.disable
    @enabled = false
  end

  ##
  # Returns true if the approval queue is enabled globally.
  def self.enabled?
    @enabled = true if @enabled.nil?
    @enabled
  end

  ##
  # Set the referenced Owner class to be used by generic finders.
  #
  # @see Ownership
  def self.owner_class=(klass)
    @owner_class = klass
  end

  ##
  # Get the referenced Owner class to be used by generic finders.
  #
  # @see Ownership
  def self.owner_class
    @owner_class
  end

  ##
  # Set the engine used for rendering view files.
  def self.view_language=(lang)
    @lang = lang
  end

  ##
  # Get the engine used for rendering view files. Defaults to 'erb'
  def self.view_language
    if Rails.version =~ /^3\./
      Rails.configuration.generators.rails[:template_engine].try(:to_s) || 'erb'
    else
      @lang || 'erb'
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
acts-as-approvable-0.6.7 lib/acts-as-approvable.rb
acts-as-approvable-0.6.6 lib/acts-as-approvable.rb
acts-as-approvable-0.6.5 lib/acts-as-approvable.rb
acts-as-approvable-0.6.4 lib/acts-as-approvable.rb
acts-as-approvable-0.6.3.3 lib/acts-as-approvable.rb
acts-as-approvable-0.6.3.2 lib/acts-as-approvable.rb
acts-as-approvable-0.6.3.1 lib/acts-as-approvable.rb
acts-as-approvable-0.6.3 lib/acts-as-approvable.rb
acts-as-approvable-0.6.2 lib/acts-as-approvable.rb