Commit 6cfb4a8b599c946f04e8a30acc132a74f87bb932
1 parent
a07fe0f0
Exists in
master
and in
29 other branches
Fix find_by_contents call
In Rails 2.3.5, that call was not working because the :include option was not being considered for some reason. Removed the :include and added the join explicitly in the query.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
app/models/environment_finder.rb
... | ... | @@ -53,7 +53,7 @@ class EnvironmentFinder |
53 | 53 | # SECURITY no risk of SQL injection, since product_category_ids comes from trusted source |
54 | 54 | @environment.send(asset).find_by_contents(query, ferret_options, options.merge({:include => 'product_categorizations', :conditions => 'product_categorizations.category_id = (%s)' % product_category.id })) |
55 | 55 | elsif product_category && asset == :enterprises |
56 | - @environment.send(asset).find_by_contents(query, ferret_options, options.merge(:joins => 'inner join product_categorizations on (product_categorizations.product_id = products.id)', :include => 'products', :conditions => "product_categorizations.category_id = (#{product_category.id})")) | |
56 | + @environment.send(asset).find_by_contents(query, ferret_options, options.merge(:joins => 'inner join products on products.enterprise_id = profiles.id inner join product_categorizations on (product_categorizations.product_id = products.id)', :conditions => "product_categorizations.category_id = (#{product_category.id})")) | |
57 | 57 | else |
58 | 58 | @environment.send(asset).find_by_contents(query, ferret_options, options) |
59 | 59 | end | ... | ... |