Rails has_many with accepts_nested_attributes_for

时间:2014-02-03 13:26:59

标签: ruby-on-rails-3 activerecord devise has-many

我有两个模型通过关系has_many: 用户模型:

  

class User< ActiveRecord :: Base

     

has_many:协议

     

accepted_nested_attributes_for:协议

     

协议模式

  

类协议<的ActiveRecord ::基

     

belongs_to:user

     

我通过seeds.rb文件发送协议:

  

Agreement.create(:agg_name =>“Agreement1”,:agg_template =>   “Agreement1 Template”,:agg_type => “新闻”)

     

Agreement.create(:agg_name =>“Agreement2”,:agg_template =>   “协议2模板”)

现在我的目标是显示agg_name 没有agg_type(即Agreement2),其中包含常规设计表单的复选框,其中包含f.email,f.password和f.confirm_password

请尽力帮助我。

0 个答案:

没有答案
相关问题