简体   繁体   中英

rails_admin has_and_belongs_to_many association

I have has_and_belongs_to_many relation in my models. I have relation beetween models Hotels and HotelRoomsTypes

class Hotel < ActiveRecord::Base
    attr_accessible hotel_room_types_attributes    
    has_and_belongs_to_many :hotel_room_types,:class_name => "HotelRoomType"
    accepts_nested_attributes_for :hotel_room_types, :allow_destroy => true
end

class HotelRoomType < ActiveRecord::Base
  attr_accessible :name
  has_and_belongs_to_many :hotels
end

when I am trying create association in rails_admin, I see following markup: 在此处输入图片说明

after creation, rails_admin doesn't show associations to those model. Anybody solved those problem or found patch to rails_admin?

I had downgraded from rails_admin 0.4.9 to 0.4.1 and problem solves.

You can track progress of solution here: https://github.com/sferik/rails_admin/issues/1737

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM