Yeng Tsan


2,410 Experience
24 Lessons Completed
0 Questions Solved


If someone is using Rails 5, notice that "the relational model MUST need the foreign key to create the instance", because the forum_thread has not created yet, the foreign key in forum_post is missing.

In Rails 5, need to add ', optional: true' to forum_post.rb

'belongs_to :forum_thread' >>> 'belongs_to :forum_thread, optional: true'

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.