为什么关系类属性不是属性?关系分类有属性错误
$ rs = ResourceServer.new
=> #<ResourceServer id: nil, resource_id: nil, server_id: nil, created_at: nil, updated_at: nil>
$ rs = ResourceServer.attributes = {:server_id => 1, :resource_id => 1}
NoMethodError: undefined method `attributes=' for #<Class:0x00000003384728>
型号:
class ResourceServer < ActiveRecord::Base
belongs_to :server
belongs_to :resource
# Validations
...
end
请你的模型添加到您的问题:) – Awea
添加,但并不intrested) –
尝试添加attr_accessible:SERVER_ID,:RESOURCE_ID – Awea