lib/searchlogic/named_scopes/associations.rb in binarylogic-searchlogic-2.1.0 vs lib/searchlogic/named_scopes/associations.rb in binarylogic-searchlogic-2.1.1

- old
+ new

@@ -27,10 +27,16 @@ # An alias being "gt" for "greater_than", etc. def association_alias_condition?(name) !association_alias_condition_details(name).nil? end + # A convenience method for creating inner join sql to that your inner joins + # are consistent with how Active Record creates them. + def inner_joins(association_name) + ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, association_name, nil).join_associations.collect { |assoc| assoc.association_join } + end + private def method_missing(name, *args, &block) if details = association_condition_details(name) create_association_condition(details[:association], details[:column], details[:condition], args) send(name, *args) @@ -91,10 +97,9 @@ if !arity || arity == 0 # The underlying condition doesn't require any parameters, so let's just create a simple # named scope that is based on a hash. options = scope.proxy_options options[:joins] = options[:joins].blank? ? association.name : {association.name => options[:joins]} - #add_left_outer_joins(options, association) options else # The underlying condition requires parameters, let's match the parameters it requires # and pass those onto the named scope. We can't use proxy_options because that returns the # result after a value has been passed. \ No newline at end of file