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 109 pending_categorizations << c
110 110 else
111 111 ArticleCategorization.add_category_to_article(c, self)
112   - self.categories(true)
  112 + self.categories(reload)
113 113 self.solr_save
114 114 end
115   - self.categories(reload)
116 115 end
117 116  
118 117 def category_ids=(ids)
... ... @@ -128,6 +127,8 @@ class Article &lt; ActiveRecord::Base
128 127 pending_categorizations.each do |item|
129 128 ArticleCategorization.add_category_to_article(item, self)
130 129 end
  130 + self.categories(true)
  131 + self.solr_save
131 132 pending_categorizations.clear
132 133 end
133 134  
... ...
test/unit/product_test.rb
... ... @@ -520,7 +520,6 @@ class ProductTest &lt; ActiveSupport::TestCase
520 520  
521 521 should 'return solidarity percentage from inputs' do
522 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 523 assert_equal 0, prod.percentage_from_solidarity_economy.first
525 524  
526 525 Input.create!(:product_id => prod.id, :product_category_id => @product_category.id,
... ...