diff --git a/app/models/environment_finder.rb b/app/models/environment_finder.rb index 90016f6..b88f62a 100644 --- a/app/models/environment_finder.rb +++ b/app/models/environment_finder.rb @@ -16,12 +16,16 @@ class EnvironmentFinder date_range = options.delete(:date_range) + # FIXME this test is in more than one place if finder_method == 'paginate' options = {:page => 1, :per_page => options.delete(:limit)}.merge(options) end if query.blank? - options = {:order => "#{asset_table(asset)}.name"}.merge(options) + # FIXME this test is in more than one place + if finder_method == 'paginate' + options = {:order => "#{asset_table(asset)}.name"}.merge(options) + end if product_category && asset == :products @environment.send(asset).send(finder_method, :all, options.merge(:include => 'product_categorizations', :conditions => ['product_categorizations.category_id = (?)', product_category.id])) elsif product_category && asset == :enterprises diff --git a/config/ferret_server.yml b/config/ferret_server.yml index 9695300..d00a370 100644 --- a/config/ferret_server.yml +++ b/config/ferret_server.yml @@ -10,3 +10,7 @@ production: # host: localhost # port: 9009 # pid_file: log/ferret.pid +staging: + host: localhost + port: 9011 + pid_file: log/ferret.pid diff --git a/db/migrate/044_create_product_categorizations.rb b/db/migrate/044_create_product_categorizations.rb index 86cec22..5fd310d 100644 --- a/db/migrate/044_create_product_categorizations.rb +++ b/db/migrate/044_create_product_categorizations.rb @@ -9,10 +9,16 @@ class CreateProductCategorizations < ActiveRecord::Migration t.timestamps end -# FIXME:uncomment after implementation -# Product.find(:all).each do |p| -# ProductCategorization.add_category_to_product(p.product_category, p) -# end + Product.find(:all).each do |p| + if p.product_category + ProductCategorization.add_category_to_product(p.product_category, p) + print ".\0" + else + print "x\0" + end + $stdout.flush + end + print "\n" end diff --git a/db/migrate/046_aggressive_indexing_strategy1.rb b/db/migrate/046_aggressive_indexing_strategy1.rb index 3a31e40..0733aae 100644 --- a/db/migrate/046_aggressive_indexing_strategy1.rb +++ b/db/migrate/046_aggressive_indexing_strategy1.rb @@ -20,13 +20,13 @@ class AggressiveIndexingStrategy1 < ActiveRecord::Migration end def self.down - add_index(:categories_profiles, :column => :profile_id) - add_index(:categories_profiles, :column => :category_id) - add_index(:product_categorizations, :column => :product_id) - add_index(:product_categorizations, :column => :category_id) - add_index(:products, :column => :enterprise_id) - add_index(:profiles, :column => :environment_id) - add_index(:blocks, :column => :box_id) - add_index(:box, :column => [:owner_type, :owner_id]) + remove_index(:categories_profiles, :column => :profile_id) + remove_index(:categories_profiles, :column => :category_id) + remove_index(:product_categorizations, :column => :product_id) + remove_index(:product_categorizations, :column => :category_id) + remove_index(:products, :column => :enterprise_id) + remove_index(:profiles, :column => :environment_id) + remove_index(:blocks, :column => :box_id) + remove_index(:boxes, :column => [:owner_type, :owner_id]) end end diff --git a/lib/sqlite_extension.rb b/lib/sqlite_extension.rb index 4e2bf8a..c749926 100644 --- a/lib/sqlite_extension.rb +++ b/lib/sqlite_extension.rb @@ -1,4 +1,4 @@ -if ActiveRecord::Base.connection.is_a?(ActiveRecord::ConnectionAdapters::SQLite3Adapter) +if ActiveRecord::Base.connection.adapter_name.downcase == 'sqlite' database = ActiveRecord::Base.connection.raw_connection -- libgit2 0.21.2