Insert data into multiple tables from one controller/view [Rails 4]
问题 I have more curious questions for all you amazing people! I am creating a forum and when you create a topic, you are also creating the first post at the same time. I need to assign variables to certain fields. Example: :user_id => current_user.id, I don't have the param settings correct, so many of the fields are NULL when stored in the database. Models class Topic < ActiveRecord::Base belongs_to :forum has_many :posts, :dependent => :destroy belongs_to :user accepts_nested_attributes_for