mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
Fix touch call to unsaved object
Failure/Error: enterprise.andand.touch
ActiveRecord::ActiveRecordError:
cannot touch on a new or destroyed record object. Consider using persisted?, new_record?, or destroyed? before touching
# ./app/models/spree/address.rb:155:in `touch_enterprise'
# ./spec/factories/product_factory.rb:12:in `block (3 levels) in <top (required)>'
# ./spec/factories/variant_factory.rb:26:in `block (4 levels) in <top (required)>'
# ./spec/models/spree/variant_spec.rb:9:in `block (2 levels) in <module:Spree>'
This commit is contained in:
@@ -152,7 +152,9 @@ module Spree
|
||||
end
|
||||
|
||||
def touch_enterprise
|
||||
enterprise.andand.touch
|
||||
return unless enterprise&.persisted?
|
||||
|
||||
enterprise.touch
|
||||
end
|
||||
|
||||
def render_address(parts)
|
||||
|
||||
Reference in New Issue
Block a user