searchlogic 2.3.14 → 2.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml
CHANGED
@@ -91,6 +91,8 @@ module Searchlogic
|
|
91
91
|
def prepare_named_scope_options(options, association)
|
92
92
|
options.delete(:readonly) # AR likes to set :readonly to true when using the :joins option, we don't want that
|
93
93
|
|
94
|
+
options[:conditions] = sanitize_sql_for_conditions(options[:conditions]) if options[:conditions].is_a?(Hash)
|
95
|
+
|
94
96
|
if options[:joins].is_a?(String) || array_of_strings?(options[:joins])
|
95
97
|
options[:joins] = [inner_joins(association.name), options[:joins]].flatten
|
96
98
|
else
|
data/searchlogic.gemspec
CHANGED
@@ -137,5 +137,9 @@ describe "Association Conditions" do
|
|
137
137
|
user = company.users.create(:company_id => company.id)
|
138
138
|
company.users.company_id_eq(company.id).should == [user]
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
|
+
it "should sanitize the scope on a foreign model instead of passing the raw options back to the original" do
|
142
|
+
Company.named_scope(:users_count_10, :conditions => {:users_count => 10})
|
143
|
+
User.company_users_count_10.proxy_options.should == {:conditions => "\"users\".\"users_count\" = 10", :joins => :company}
|
144
|
+
end
|
141
145
|
end
|