【发布时间】:2015-02-18 10:20:10
【问题描述】:
宝石文件
gem 'rails', '4.1.7'
gem 'activeadmin', github: 'activeadmin'
健康状况
模型:健康档案
has_and_belongs_to_many :health_concerns, :join_table => :health_profile_health_concerns
表名:health_profiles
health_profiles
id
name
健康状况健康问题
模型 HealthProfileHealthConcern
表名 = health_profile_health_concerns
health_profile_health_concerns
health_profile_id
health_concerns_id
健康问题
健康关注模型
has_and_belongs_to_many :health_profiles, :join_table => :health_profile_health_concerns
表名 = health_concerns
health_concerns
id
name
我的目标是访问选定的 health_profile 的 health_concerns。
我应该创建这样的链接吗?但是对于这个例子(血压),我使用了与 has_and_belongs_to_many 不同的多对多关系
li link_to "Blood Pressure", admin_health_profile_blood_pressures_path(health_profile)
【问题讨论】:
标签: ruby-on-rails ruby activeadmin