In Rails, how do I create nested objects using accepts_nested_attributes_for?
问题 In my Rails application, I am attempting to set up creation form for a TrainingClass model. I want this form to allow the user to create multiple ClassMeeting models (which have a belongs_to relationship with the TrainingClass model) within the same form, and I am using accepts_nested_attributes_for to do this. Unfortunately, whenever I submit the form I get the error message: Meetings class can't be blank . I realize that this is because ClassMeeting has validates :class_id, presence: true ,