Commit a418a384ae17cf3c680f3789a0ab4b2c5edf4322

Authored by Rafael Martins
1 parent 096b2932

Fixed category reloading in articles

* Removed wrong puts in ProductTest
app/models/article.rb
@@ -109,10 +109,9 @@ class Article < ActiveRecord::Base @@ -109,10 +109,9 @@ class Article < ActiveRecord::Base
109 pending_categorizations << c 109 pending_categorizations << c
110 else 110 else
111 ArticleCategorization.add_category_to_article(c, self) 111 ArticleCategorization.add_category_to_article(c, self)
112 - self.categories(true) 112 + self.categories(reload)
113 self.solr_save 113 self.solr_save
114 end 114 end
115 - self.categories(reload)  
116 end 115 end
117 116
118 def category_ids=(ids) 117 def category_ids=(ids)
@@ -128,6 +127,8 @@ class Article &lt; ActiveRecord::Base @@ -128,6 +127,8 @@ class Article &lt; ActiveRecord::Base
128 pending_categorizations.each do |item| 127 pending_categorizations.each do |item|
129 ArticleCategorization.add_category_to_article(item, self) 128 ArticleCategorization.add_category_to_article(item, self)
130 end 129 end
  130 + self.categories(true)
  131 + self.solr_save
131 pending_categorizations.clear 132 pending_categorizations.clear
132 end 133 end
133 134
test/unit/product_test.rb
@@ -520,7 +520,6 @@ class ProductTest &lt; ActiveSupport::TestCase @@ -520,7 +520,6 @@ class ProductTest &lt; ActiveSupport::TestCase
520 520
521 should 'return solidarity percentage from inputs' do 521 should 'return solidarity percentage from inputs' do
522 prod = fast_create(Product, :name => 'test product1', :product_category_id => @product_category.id, :enterprise_id => @profile.id) 522 prod = fast_create(Product, :name => 'test product1', :product_category_id => @product_category.id, :enterprise_id => @profile.id)
523 - puts "$$$$ #{prod.percentage_from_solidarity_economy}"  
524 assert_equal 0, prod.percentage_from_solidarity_economy.first 523 assert_equal 0, prod.percentage_from_solidarity_economy.first
525 524
526 Input.create!(:product_id => prod.id, :product_category_id => @product_category.id, 525 Input.create!(:product_id => prod.id, :product_category_id => @product_category.id,