Class: Authlogic::ActsAsAuthentic::Queries::FindWithCase Private
- Inherits:
-
Object
- Object
- Authlogic::ActsAsAuthentic::Queries::FindWithCase
- Defined in:
- lib/authlogic/acts_as_authentic/queries/find_with_case.rb
Overview
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.
The query used by public-API method ‘find_by_smart_case_login_field`.
We use the rails methods ‘case_insensitive_comparison` and `case_sensitive_comparison`. These methods nicely take into account MySQL collations. (Consider the case where a user says they want a case-sensitive uniqueness validation, but then they configure their database to have an insensitive collation. Rails will handle this for us, by downcasing, see `active_record/connection_adapters/abstract_mysql_adapter.rb`) So that’s great! But, these methods are not part of rails’ public API, so there are no docs. So, everything we know about how to use the methods correctly comes from mimicing what we find in ‘active_record/validations/uniqueness.rb`.
Constant Summary collapse
- AR_GEM_VERSION =
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.
Dup ActiveRecord.gem_version before freezing, in case someone else wants to modify it. Freezing modifies an object in place. github.com/binarylogic/authlogic/pull/590
::ActiveRecord.gem_version.dup.freeze
Instance Method Summary collapse
- #execute ⇒ Object private
-
#initialize(model_class, field, value, sensitive) ⇒ FindWithCase
constructor
private
A new instance of FindWithCase.
Constructor Details
#initialize(model_class, field, value, sensitive) ⇒ FindWithCase
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 FindWithCase.
28 29 30 31 32 33 |
# File 'lib/authlogic/acts_as_authentic/queries/find_with_case.rb', line 28 def initialize(model_class, field, value, sensitive) @model_class = model_class @field = field.to_s @value = value @sensitive = sensitive end |
Instance Method Details
#execute ⇒ Object
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.
36 37 38 |
# File 'lib/authlogic/acts_as_authentic/queries/find_with_case.rb', line 36 def execute @model_class.where(comparison).first end |