我在尝试创建新的限制或编辑限制时遇到此错误(如下模型)
Rails_admin/main中的ArgumentError #ArgumentError
显示/Users/deini/.rvm/gems/ruby-2.0.0-p195/gems/rails_admin-0.4.9/app/views/rails_admin/main/_form_filtering_select.html.haml在第11行出现的位置:
参数数量错误(0表示1+)
提取的源代码(在第11行附近):(selected_id = field.selected_id)
selected_id = selected.send(field.associated_primary_key)
selected_name = selected.send(field.associated_object_label_method)
else
selected_id = field.selected_id
selected_name = field.formatted_value
endSystem.rb
class System < ActiveRecord::Base
has_many :attachments
has_many :limitations
has_many :companies, :through => :limitations
accepts_nested_attributes_for :attachments
accepts_nested_attributes_for :companies
attr_accessible :conf_type, :version, :hardware_type, :name, :attachments_attributes, :company_ids, :companies_attributes
rails_admin do
list do
exclude_fields :created_at, :updated_at
end
end
endcompany.rb
class Company < ActiveRecord::Base
belongs_to :distributor
has_many :users, dependent: :destroy
has_many :limitations
has_many :systems, :through => :limitations
accepts_nested_attributes_for :limitations
attr_accessible :distributor_id, :name, :system_ids, :email, :limitations_attributes
rails_admin do
list do
exclude_fields :custom_url, :created_at, :updated_at
end
edit do
exclude_fields :custom_url, :users
end
end
endlimitation.rb
class Limitation < ActiveRecord::Base
belongs_to :company
belongs_to :system
attr_accessible :company_id, :system_id, :version_limit
end我没有在我的rails_admin中修改任何东西,你知道我做错了什么吗?
发布于 2017-05-05 12:53:33
实际上,我也遇到了同样的错误。但是,当我在整个代码中将名称System更改为其他名称(包括模型、表名和所有名称)时,我的代码开始正常工作。尝试使用其他单词更改名称System。
https://stackoverflow.com/questions/18164042
复制相似问题