Reputation: 113
I'm getting this error while trying to create a new or edit a Limitation (model below)
ArgumentError in Rails_admin/main#new
Showing /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 where line #11 raised:
wrong number of arguments (0 for 1+)
Extracted source (around line #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
I haven't modify anything in my rails_admin, any ideas of what I'm doing wrong?
Upvotes: 1
Views: 624
Reputation: 413
Actually i too got the same error. But then when i changed the name System to some other name in my entire code including model,table name and all, my code starts to work fine. Try changing the name System with some other word.
Upvotes: 1