Module: ActiveRecordWhereAssoc

Defined in:
lib/active_record_where_assoc/relation_returning_methods.rb,
lib/active_record_where_assoc.rb,
lib/active_record_where_assoc/version.rb,
lib/active_record_where_assoc/core_logic.rb,
lib/active_record_where_assoc/exceptions.rb,
lib/active_record_where_assoc/active_record_compat.rb,
lib/active_record_where_assoc/sql_returning_methods.rb,
lib/active_record_where_assoc/relation_returning_delegates.rb

Overview

See RelationReturningMethods

Defined Under Namespace

Modules: ActiveRecordCompat, CoreLogic, RelationReturningDelegates, RelationReturningMethods, SqlReturningMethods Classes: MySQLDoesntSupportSubLimitError, NeverAliasLimitDoesntWorkWithCompositePrimaryKeysError, PolymorphicBelongsToWithoutClasses

Constant Summary collapse

VERSION =
"1.2.1".freeze

Class Method Summary collapse

Class Method Details

.default_optionsObject

Default options for the gem. Meant to be modified in place by external code, such as in an initializer. Ex:

ActiveRecordWhereAssoc.default_options[:ignore_limit] = true

A description for each can be found in RelationReturningMethods@Options.

:ignore_limit is the only one to consider changing, when you are using MySQL, since limit are never supported on it. Otherwise, the safety of having to pass the options yourself and noticing you made a mistake / avoiding the need for extra queries is worth the extra code.



17
18
19
20
21
22
23
# File 'lib/active_record_where_assoc.rb', line 17

def self.default_options
  @default_options ||= {
                         ignore_limit: false,
                         never_alias_limit: false,
                         poly_belongs_to: :raise,
                       }
end