Module: ActiveRecord::Extensions::FinderOptions

Defined in:
lib/ar-extensions/finder_options.rb

Defined Under Namespace

Modules: ClassMethods, ConstructSqlCompatibility, HavingOptionBackCompatibility

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/ar-extensions/finder_options.rb', line 48

def self.included(base)

  #alias and include only if not yet defined
  unless base.respond_to?(:construct_finder_sql_ext)
    base.extend ClassMethods
    base.extend ActiveRecord::Extensions::SqlGeneration
    base.extend HavingOptionBackCompatibility
    base.extend ConstructSqlCompatibility

    base.class_eval do
      class << self
        VALID_FIND_OPTIONS.concat([:pre_sql, :post_sql, :keywords, :ignore, :rollup, :override_select, :having, :index_hint])
        alias_method              :construct_finder_sql, :construct_finder_sql_ext
        alias_method_chain        :construct_finder_sql_with_included_associations, :ext
      end
    end
  end
end