我使用 Rails 4.1.1、ruby 2.1、mongodb、mongoid 作为包装器,rails_admin 用于创建管理界面
我知道'attr_accessible' 不再适用于 Rails4。所以我安装了'protected_attributes' gem。但仍然没有成功我仍然在我的控制台中收到警告
[RailsAdmin] Could not load model Company, assuming model is non existing. (undefined method `attr_accessible' for Company:Class)
所以,rails admin 不加载类 Company,因为我在模型中定义了 attr_accessible。这是我的公司模型。
class Company
include Mongoid::Document
@@employees_strength = {0 => '0-10', 1 => '11-50', 2 => '51-100', 3 => '101-500', 4 => '501-1000', 5 => '1000+', 6 => '5000+'}
field :name, type: String
field :website, type: String
field :domain_name, type: String
field :strength, type: Integer
has_many :employees
has_one :admin, :class_name => 'Employee', :dependent => :destroy, :inverse_of => :organization
#attr_accessible :name, :website, :domain_name, :strength#, :admin_attributes, :allow_destroy => true
attr_accessible :admin_attributes
accepts_nested_attributes_for :admin, :allow_destroy => true
end
请问有什么可以帮忙的吗?谢谢