Rails 3.2 Create Parent Model from Child View

后端 未结 2 1764
攒了一身酷
攒了一身酷 2021-01-21 20:25

I\'m having a difficult time understanding how to do this. I have two models, a project, and a course.

#project.rb
belongs_to :course
attr_accessible :course_id,         


        
2条回答
  •  萌比男神i
    2021-01-21 21:02

    I used gem 'dynamic_form'. faculty_list(id, faculty_name) table contains names of faculties.

    <%= f.select :faculty, options_from_collection_for_select(@faculty_list, 'id', 'faculty_name', @faculty.faculty.to_i) %>
    

提交回复
热议问题