관계 클래스 속성이 속성이 아닌 이유는 무엇입니까?관계 clasess에는 속성 오류가 있습니다
$ 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>
모델 : 귀하의 클래스 ResourceServer
에 아닌 객체 rs
에 #attributes=
인스턴스 메소드를 호출해서
class ResourceServer < ActiveRecord::Base
belongs_to :server
belongs_to :resource
# Validations
...
end
질문 : – Awea
추가로 모델을 추가하십시오, 그러나에 intrested하지 않음) attr_accessible 추가 –
보십시오 : SERVER_ID을 : – Awea