Sha256: 555aa5044f98fa58bc01a93cd28b913c78aa0c793bcd5e06f661fed0ffb8685b
Contents?: true
Size: 844 Bytes
Versions: 2
Compression:
Stored size: 844 Bytes
Contents
module Searchlogic # Active Record is pretty inconsistent with how their SQL is constructed. This # method attempts to close the gap between the various inconsistencies. module ActiveRecordConsistency def self.included(klass) klass.class_eval do alias_method_chain :merge_joins, :searchlogic end end # In AR multiple joins are sometimes in a single join query, and other time they # are not. The merge_joins method in AR should account for this, but it doesn't. # This fixes that problem. def merge_joins_with_searchlogic(*args) joins = merge_joins_without_searchlogic(*args) joins.collect { |j| j.split(" ") }.flatten.uniq end end end module ActiveRecord # :nodoc: all class Base class << self include Searchlogic::ActiveRecordConsistency end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
binarylogic-searchlogic-2.1.4 | lib/searchlogic/active_record_consistency.rb |
searchlogic-2.1.4 | lib/searchlogic/active_record_consistency.rb |