[英]There is no select field in rails_admin
我有兩個簡單的模型:
class Category < ActiveRecord::Base
attr_accessible :id, :name, :description
has_many :tags
end
class Tag < ActiveRecord::Base
belongs_to :category
attr_accessible :id, :name
end
但是在rails_admin中,我沒有下拉菜單來設置標簽的類別。 我僅看到“類別:-”,而沒有其他內容。 是什么原因?
您需要將:category_id
添加到attr_accessible
class Tag < ActiveRecord::Base
belongs_to :category
attr_accessible :id, :name, :category_id
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.