rails_admin has_and_belongs_to_many关联

时间:2013-09-06 14:07:54

标签: ruby-on-rails rails-admin

我的模特中有has_and_belongs_to_many关系。我和模特酒店和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

当我尝试在rails_admin中创建关联时,我看到以下标记: enter image description here

创建后,rails_admin不会显示与这些模型的关联。有人解决了这些问题或找到了rails_admin的补丁吗?

1 个答案:

答案 0 :(得分:0)

我已经从rails_admin 0.4.9降级到0.4.1并解决了问题。

您可以在此处跟踪解决方案的进度: https://github.com/sferik/rails_admin/issues/1737