我有一个非常基本的has_many :through
设置:
class Housing < ApplicationRecord
has_many :facilities_housings
has_many :facilities, through: :facilities_housings
...
end
class Facility < ApplicationRecord
has_many :facilities_housings
has_many :housings, through: :facilities_housings
...
end
class FacilitiesHousing < ApplicationRecord
belongs_to :facility, inverse_of: :facilities_housings
belongs_to :housing, inverse_of: :facilities_housings
...
end
我想创建一个如下所示的表单:
根据第一个复选框,应列出并添加/删除所有工具。
我知道这对于activeadmin中包含的帮助器中的has_many
非常简单,但UX对于这个用例并不是很好。