我使用has_many :through
由具有三种模式的关系:HAS_MANY:通过关联
class Curriculum class < ActiveRecord::Base
has_many :interests
has_many :vacancies,: through => :interests
end
class Vacancy class < ActiveRecord::Base
has_many :interests
has_many :resumes,: through => :interests
end
class Interest < ActiveRecord:: Base
belongs_to :vacancy
belongs_to :curriculum
end
并创建课程和空缺,我通过行政创建它们,我需要知道我怎样才能创建感兴趣空缺的ID,以及如何登录系统,我必须得到它的ID,并建立新的银行利益关系。我想知道如何编程来做到这一点,我想知道控制器将如何获得创建操作,以及有什么更好的方法来做到这一点。
我忘了上面的评论,但我是新的红宝石轨道上,请不要考虑一些错误。 – 2011-12-14 17:20:32