Sha256: c6f77508c820863d9ff028de55968d0a48cd7e3050f4b2528ba3ba2e8030a435

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

module Searchlogic
  module ActiveRecord
    module AssociationProxy
      def self.included(klass)
        klass.class_eval do
          alias_method_chain :send, :searchlogic
        end
      end

      def send_with_searchlogic(method, *args, &block)
        # create the scope if it doesn't exist yet, then delegate back to the original method
        if !proxy_respond_to?(method) && proxy_reflection.macro != :belongs_to && !proxy_reflection.options[:polymorphic] && proxy_reflection.klass.condition?(method)
          proxy_reflection.klass.send(method, *args, &block)
        end

        send_without_searchlogic(method, *args, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
searchlogic-2.4.32 lib/searchlogic/active_record/association_proxy.rb