Commit 76fe0ea9cb82a9b8b2662d8cf00825ce01bf8183
1 parent
31868a1a
Exists in
send_email_to_admins
and in
5 other branches
products: only consider visible profiles
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
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 |