From 7e12142f91551bfb3e85fa1fd8ee5b29c776b7ef Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 2 Mar 2020 17:06:08 +0000 Subject: [PATCH 1/2] Collection must be after load_data so that hubs are already available for VOs calculation --- app/controllers/admin/variant_overrides_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/variant_overrides_controller.rb b/app/controllers/admin/variant_overrides_controller.rb index 07894a9498..31aff8ce8c 100644 --- a/app/controllers/admin/variant_overrides_controller.rb +++ b/app/controllers/admin/variant_overrides_controller.rb @@ -5,7 +5,7 @@ module Admin include OpenFoodNetwork::SpreeApiKeyLoader include EnterprisesHelper - before_filter :load_data + prepend_before_filter :load_data before_filter :load_collection, only: [:bulk_update] before_filter :load_spree_api_key, only: :index From f3e651b1f7491f30c05dcce4f4b87e749b856335 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 28 Apr 2020 16:26:10 +0100 Subject: [PATCH 2/2] present? calls length which is breaking it with error ActiveModel::MissingAttributeError Exception: missing attribute: address_id any? works well as it just verifies the size of the collection --- app/models/enterprise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 4c90dae789..0e60be9a14 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -118,7 +118,7 @@ class Enterprise < ActiveRecord::Base except(:select). select('DISTINCT enterprises.id') - if ready_enterprises.present? + if ready_enterprises.any? where("enterprises.id NOT IN (?)", ready_enterprises) else where(nil)