searchlogic 2.4.0 → 2.4.1
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
@@ -114,7 +114,7 @@ module Searchlogic
|
|
114
114
|
if options[:joins].is_a?(String) || array_of_strings?(options[:joins])
|
115
115
|
options[:joins] = [poly_class ? poly_join : inner_joins(association.name), options[:joins]].flatten
|
116
116
|
elsif poly_class
|
117
|
-
options[:joins] = options[:joins].blank? ? poly_join : [poly_join
|
117
|
+
options[:joins] = options[:joins].blank? ? poly_join : ([poly_join] + klass.inner_joins(options[:joins]))
|
118
118
|
else
|
119
119
|
options[:joins] = options[:joins].blank? ? association.name : {association.name => options[:joins]}
|
120
120
|
end
|
data/searchlogic.gemspec
CHANGED
@@ -143,10 +143,17 @@ describe "Association Conditions" do
|
|
143
143
|
User.company_users_count_10.proxy_options.should == {:conditions => "\"companies\".\"users_count\" = 10", :joins => :company}
|
144
144
|
end
|
145
145
|
|
146
|
-
it "should
|
146
|
+
it "should delegate to polymorphic relationships" do
|
147
147
|
Audit.auditable_user_type_name_like("ben").proxy_options.should == {
|
148
148
|
:conditions => ["users.name LIKE ?", "%ben%"],
|
149
149
|
:joins => "INNER JOIN \"users\" ON \"users\".id = \"audits\".auditable_id AND \"audits\".auditable_type = 'User'"
|
150
150
|
}
|
151
151
|
end
|
152
|
+
|
153
|
+
it "should deep delegate to polymorphic relationships" do
|
154
|
+
Audit.auditable_user_type_company_name_like("company").proxy_options.should == {
|
155
|
+
:conditions => ["companies.name LIKE ?", "%company%"],
|
156
|
+
:joins => ["INNER JOIN \"users\" ON \"users\".id = \"audits\".auditable_id AND \"audits\".auditable_type = 'User'", " INNER JOIN \"companies\" ON \"companies\".id = \"users\".company_id "]
|
157
|
+
}
|
158
|
+
end
|
152
159
|
end
|