나는 3 개 테이블을했습니다 models/profile.rb
에서레일 관계
has_one :profile, :dependent => :destroy
has_one :payment_detail, :dependent => :destroy
내가 가진 :
has_one :payment_detail, :through => :user
그리고 models/payment_details.rb
에 나는 가지고있다 :
has_one :profile, :through => :user
그런 다음 중첩 된 양식이있는 :profile
양식이 있습니다. 어떤 이유 :payment_details
를 들어
:user_id
이 문서를 바탕으로
:profiles
각 관계의 'belongs_to'부분이 누락 된 것 같습니다. 그저 복사 - 붙여 넣기 생략일까요? – Chowlett
예,'payments_detail'과'profile' 모델 모두에'belongs_to : user'가 있습니다. –
양식과 컨트롤러가 포함 된 뷰를 제공하십시오. – Jesper