![](/img/trans.png)
[英]Issue when create new user in admin using Rails_admin gem in Rails
[英]rails_admin ArgumentError when trying to edit or create a new entry
嘗試創建新的或編輯限制(以下模型)時出現此錯誤
Rails_admin / main#new中的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
end
System.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
end
company.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
end
limitation.rb
class Limitation < ActiveRecord::Base
belongs_to :company
belongs_to :system
attr_accessible :company_id, :system_id, :version_limit
end
我沒有在rails_admin中進行任何修改,對我做錯的任何想法?
其實我也有同樣的錯誤。 但是當我在整個代碼中將系統名稱更改為其他名稱時,包括模型,表名和所有名稱,我的代碼開始正常工作。 嘗試使用其他單詞更改名稱System 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.