From a418a384ae17cf3c680f3789a0ab4b2c5edf4322 Mon Sep 17 00:00:00 2001 From: Rafael Martins Date: Fri, 25 May 2012 18:04:57 -0300 Subject: [PATCH] Fixed category reloading in articles --- app/models/article.rb | 5 +++-- test/unit/product_test.rb | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/article.rb b/app/models/article.rb index f4a300e..99728c6 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -109,10 +109,9 @@ class Article < ActiveRecord::Base pending_categorizations << c else ArticleCategorization.add_category_to_article(c, self) - self.categories(true) + self.categories(reload) self.solr_save end - self.categories(reload) end def category_ids=(ids) @@ -128,6 +127,8 @@ class Article < ActiveRecord::Base pending_categorizations.each do |item| ArticleCategorization.add_category_to_article(item, self) end + self.categories(true) + self.solr_save pending_categorizations.clear end diff --git a/test/unit/product_test.rb b/test/unit/product_test.rb index 6fd875d..d9471ae 100644 --- a/test/unit/product_test.rb +++ b/test/unit/product_test.rb @@ -520,7 +520,6 @@ class ProductTest < ActiveSupport::TestCase should 'return solidarity percentage from inputs' do prod = fast_create(Product, :name => 'test product1', :product_category_id => @product_category.id, :enterprise_id => @profile.id) - puts "$$$$ #{prod.percentage_from_solidarity_economy}" assert_equal 0, prod.percentage_from_solidarity_economy.first Input.create!(:product_id => prod.id, :product_category_id => @product_category.id, -- libgit2 0.21.2