turingschool / curriculum

Turing's main repository of tutorials and projects
385 stars 502 forks source link

Merchant Iteration 6: Rails 5 makes belongs_to association required by default #1218

Open MikeyParton opened 8 years ago

MikeyParton commented 8 years ago

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):