With Rails 5, you have to explicitly declare belongs_to :user, optional: true
in /models/order.rb
Otherwise, you will get this error when you try to create an order while not logged in
ActiveRecord::RecordInvalid (Validation failed: User must exist):
With Rails 5, you have to explicitly declare
belongs_to :user, optional: true
in /models/order.rbOtherwise, you will get this error when you try to create an order while not logged in
ActiveRecord::RecordInvalid (Validation failed: User must exist):