![](/img/trans.png)
[英]Custom Active Admin form inputs for has_and_belongs_to_many relationship
[英]Active Admin - has_and_belongs_to_many relationships
gem 'rails', '4.1.7'
gem 'activeadmin', github: 'activeadmin'
has_and_belongs_to_many :health_concerns, :join_table => :health_profile_health_concerns
health_profiles
id
name
表名稱= 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)
我會使用has_many througth關聯。
在Active Admin中has_and_belongs_to_many可能花費很少的時間。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.