I cannot figure out how I can setup a form that will create a new Study while also creating the related StudySubject and the Facility. The user_id, facility_id and study_subject_id have to be available to create the Study object as you can see in the database relation model.

Here is the migration for the studies. The other tables do not contain foreign keys.
def self.up
create_table :studies do |t|
t.references :user
t.references :facility
t.references :subject
t.date "from"
t.date "till"
t.timestamps
end
add_index :studies, ["user_id", "facility_id", "subject_id"], :unique => true
end
The models define the following associations.
# user.rb
has_many :studies
# subject.rb
has_many :studies
# facility.rb
has_many :studies
# study
belongs_to :user
belongs_to :subject
belongs_to :facility
Questions
1) Are the has_many and belongs_to definitions correct?
2) How can I create a study using accepts_nested_attributes_for?
3) A study should only belong to one user. Do I need to add the user_id into every other object to store the association?
I am totally new to Rails since 2 weeks of extensive learning. Sorry for a stupid question maybe.