Sha256: 8737f1e18884fc39c3b51e07fc21a995f015e5e2159087f350b99eca513f5c1a

Contents?: true

Size: 1.05 KB

Versions: 1

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.validation_scope = :company_id
        #   end
        #
        # * <tt>Default:</tt> nil
        # * <tt>Accepts:</tt> Symbol or Array of symbols
        def validations_scope(value = nil)
          config(:validations_scope, value)
        end
        alias_method :validations_scope=, :validations_scope
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authlogic-2.0.0 lib/authlogic/acts_as_authentic/validations_scope.rb