has_and_belongs_to_many 방법 사용 주의
601 단어 long
Primary key is not allowed in a has_and_belongs_to_many join table (arts_pages).
프로젝트 때문에 has 를 사 용 했 습 니 다.and_belongs_to_many,실행 코드:
n = Art.find 22
n.pages << Page.new
다음 오류 가 발생 했 습 니 다:
Primary key is not allowed in a has_and_belongs_to_many join table (arts_pages)
원래 잘못된 이 유 는 내 가 만 든 중간 표:artspages 에 id 필드 가 하나 더 생 겼 습 니 다.
수정 방법:
create_table :arts_pages , :id => false do |t|
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
uva 10285 Longest Run on a Snowboard기초 DP 복습, 기억화 검색 제목: 이름과 n*m 행렬을 주십시오. 다음은 행렬 정보입니다. 매번 한 칸에서 상하좌우로 이동할 수 있지만 그 숫자는 현재 있는 칸보다 작아야 합니다.임의의 점에서 출발해서 가장 긴 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.