0

belongs_to 나는 간단한 has_many를 생성 한 두 activerecords과의 관계 belongs_to 난, 초기화되지 않은 일정 도구 :: 버전을 만들려고 할 때레일 3은 일정한 오류, has_many을 초기화되지 않은

tool.rb :

class Tool < ActiveRecord::Base 
    attr_accessible :name 
    validates_presence_of :name 
    has_many :versions 
end 

:

abc.html.erb

class Versions < ActiveRecord::Base 
    belongs_to :tool 
    attr_accessible :tool_version 
end 

versions.rb

on submit 나는 오류가 발생합니다. 내가 여기서 뭐하는거야?

답변

0

귀하의 text_field는 클래스 이름이 Version을해야

당신은 클래스 이름을 변경해야합니다

0

tool_version하지 버전이 아닌 Versions

class Versions < ActiveRecord::Base 
    belongs_to :tool 
    attr_accessible :tool_version 
end 
해야한다