Commit 76fe0ea9cb82a9b8b2662d8cf00825ce01bf8183

Authored by Braulio Bhavamitra
1 parent 31868a1a

products: only consider visible profiles

db/migrate/20160422163123_enable_products_plugin_on_environments.rb
@@ -20,7 +20,8 @@ class EnableProductsPluginOnEnvironments < ActiveRecord::Migration @@ -20,7 +20,8 @@ class EnableProductsPluginOnEnvironments < ActiveRecord::Migration
20 20
21 Bundler.clean_system 'script/noosfero-plugins enable products' 21 Bundler.clean_system 'script/noosfero-plugins enable products'
22 environments.each do |e| 22 environments.each do |e|
23 - next unless e.products.count > 0 23 + products = e.products.where('profiles.visible = true')
  24 + next unless products.count > 0
24 e.enabled_plugins << 'ProductsPlugin' 25 e.enabled_plugins << 'ProductsPlugin'
25 e.save! 26 e.save!
26 end 27 end