From 6cfb4a8b599c946f04e8a30acc132a74f87bb932 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 23 Feb 2011 14:15:47 -0300 Subject: [PATCH] Fix find_by_contents call --- app/models/environment_finder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/environment_finder.rb b/app/models/environment_finder.rb index 17050fd..3cd96e0 100644 --- a/app/models/environment_finder.rb +++ b/app/models/environment_finder.rb @@ -53,7 +53,7 @@ class EnvironmentFinder # SECURITY no risk of SQL injection, since product_category_ids comes from trusted source @environment.send(asset).find_by_contents(query, ferret_options, options.merge({:include => 'product_categorizations', :conditions => 'product_categorizations.category_id = (%s)' % product_category.id })) elsif product_category && asset == :enterprises - @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})")) + @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})")) else @environment.send(asset).find_by_contents(query, ferret_options, options) end -- libgit2 0.21.2