mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Call @order_cycles.count instead of #size because TagRuleApplicator doesn't return Relation anymore
In March 2020 this was changed to use :size instead of :count because TagRuleApplicator returned an ActiveRecord::Relation, see:d2eee1dafdHowever in October 2020 TagRuleApplicator was changed to always return an Array so this is no longer needed, see:7e606471e4
This commit is contained in:
@@ -22,12 +22,8 @@ class BaseController < ApplicationController
|
||||
end
|
||||
|
||||
# Default to the only order cycle if there's only one
|
||||
#
|
||||
# Here we need to use @order_cycles.size not @order_cycles.count
|
||||
# because OrderCyclesList returns a modified ActiveRecord::Relation
|
||||
# and these modifications are not seen if it is reloaded with count
|
||||
def set_order_cycle
|
||||
return if @order_cycles.size != 1
|
||||
return if @order_cycles.count != 1
|
||||
|
||||
current_order(true).set_order_cycle! @order_cycles.first
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user