diff --git a/app/models/closet_hanger.rb b/app/models/closet_hanger.rb index dca7f13d..c3f29835 100644 --- a/app/models/closet_hanger.rb +++ b/app/models/closet_hanger.rb @@ -36,8 +36,10 @@ class ClosetHanger < ActiveRecord::Base before_validation :merge_quantities, :set_owned_by_list - flex.parent :item, 'item' => 'closet_hanger' - flex.sync self + if Flex::Configuration.hangers_enabled + flex.parent :item, 'item' => 'closet_hanger' + flex.sync self + end def flex_source { diff --git a/app/models/item/search/query.rb b/app/models/item/search/query.rb index 64358158..afa84c16 100644 --- a/app/models/item/search/query.rb +++ b/app/models/item/search/query.rb @@ -193,7 +193,8 @@ class Item raise Item::Search::Error, message end - if key == :user_closet_hanger_ownership + if (!Flex::Configuration.hangers_enabled && + key == :user_closet_hanger_ownership) Item::Search.error 'user_filters_disabled' end diff --git a/config/initializers/flex.rb b/config/initializers/flex.rb index ba0ea54f..89f52459 100644 --- a/config/initializers/flex.rb +++ b/config/initializers/flex.rb @@ -16,6 +16,8 @@ Flex::Configuration.configure do |config| # The custom url of your ElasticSearch server config.base_uri = 'http://impress.openneo.net:9200' if Rails.env.production? + + config.hangers_enabled = !Rails.env.production? # Set it to true to log the debug infos (true by default in development mode) # config.debug = false