Sha256: bc614ae88dae27ef95b7e76be610e09187d4328c42227e8c58273023984f997b

Contents?: true

Size: 1.05 KB

Versions: 66

Compression:

Stored size: 1.05 KB

Contents

module Authlogic
  module ActsAsAuthentic
    # Allows you to scope everything to specific fields.
    # See the Config submodule for more info.
    # For information on how to scope off of a parent object see Authlogic::AuthenticatesMany
    module ValidationsScope
      def self.included(klass)
        klass.class_eval do
          extend Config
        end
      end
      
      # All configuration for the scope feature.
      module Config
        # Allows you to scope everything to specific field(s). Works just like validates_uniqueness_of.
        # For example, let's say a user belongs to a company, and you want to scope everything to the
        # company:
        #
        #   acts_as_authentic do |c|
        #     c.validations_scope = :company_id
        #   end
        #
        # * <tt>Default:</tt> nil
        # * <tt>Accepts:</tt> Symbol or Array of symbols
        def validations_scope(value = nil)
          rw_config(:validations_scope, value)
        end
        alias_method :validations_scope=, :validations_scope
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 22 rubygems

Version Path
authlogic-3.4.6 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.5 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-2.1.11 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-2.1.10 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.4 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.3 lib/authlogic/acts_as_authentic/validations_scope.rb
binarylogic-authlogic-2.1.0 lib/authlogic/acts_as_authentic/validations_scope.rb
binarylogic-authlogic-2.1.1 lib/authlogic/acts_as_authentic/validations_scope.rb
crankharder-authlogic-2.1.1 lib/authlogic/acts_as_authentic/validations_scope.rb
jlecour-authlogic-2.1.2 lib/authlogic/acts_as_authentic/validations_scope.rb
kschrader-authlogic-2.1.2 lib/authlogic/acts_as_authentic/validations_scope.rb
kschrader-authlogic-2.1.3 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.2 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.1 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.4.0 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.3.0 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.2.0 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-3.1.3 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-2.1.8 lib/authlogic/acts_as_authentic/validations_scope.rb
authlogic-2.1.7 lib/authlogic/acts_as_authentic/validations_scope.rb