Class: Authlogic::ActsAsAuthentic::Queries::CaseSensitivity Private

Inherits:
Object
  • Object
show all
Defined in:
lib/authlogic/acts_as_authentic/queries/case_sensitivity.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

E_UNABLE_TO_DETERMINE_SENSITIVITY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

<<~EOS
  Authlogic was unable to determine what case-sensitivity to use when
  searching for email/login. To specify a sensitivity, validate the
  uniqueness of the email/login and use the `case_sensitive` option,
  like this:

      validates :email, uniqueness: { case_sensitive: false }

  Authlogic will now perform a case-insensitive query.
EOS

Instance Method Summary collapse

Constructor Details

#initialize(model_class, attribute) ⇒ CaseSensitivity

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CaseSensitivity.



20
21
22
23
# File 'lib/authlogic/acts_as_authentic/queries/case_sensitivity.rb', line 20

def initialize(model_class, attribute)
  @model_class = model_class
  @attribute = attribute.to_sym
end

Instance Method Details

#sensitive?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


26
27
28
29
30
31
32
33
34
# File 'lib/authlogic/acts_as_authentic/queries/case_sensitivity.rb', line 26

def sensitive?
  sensitive = uniqueness_validator_options[:case_sensitive]
  if sensitive.nil?
    ::Kernel.warn(E_UNABLE_TO_DETERMINE_SENSITIVITY)
    false
  else
    sensitive
  end
end