Member (테이블 용)를 만드는 동안 문제가 있습니다. '신입 회원'을 클릭 할 때마다 '신입 회원'을 만들 때마다 '제출'을 클릭 한 것처럼 자동으로 새 회원이 저장됩니다. 양식을 조정하면서 페이지를 다시로드 할 때마다 멤버도 만들어집니다. 내 컨트롤러에서 오타가있을 수 있습니다. 여기 'def new'가 있습니다.Twitter Bootstrap Rails : "NEW"를 클릭하면 저장됩니다.
def new
@member = Member.new
@member.association_id = @association.id
@member.save
3.times { @member.submembers << Submember.new() }
end
그렇지 않으면 일부 스크립트에서 오류가 발생할 수 있습니다. 질문은 어떻게 해결할 수 있습니까?
감사합니다.
다른 정보가 필요하면 여기에 의견을 남기십시오.
오류 메시지 :
Problem:
Calling Document.find with nil is invalid.
Summary:
Document.find expects the parameters to be 1 or more ids, and will return a single document if 1 id is provided, otherwise an array of documents if multiple ids are provided.
Resolution:
Most likely this is caused by passing parameters directly through to the find, and the parameter either is not present or the key from which it is accessed is incorrect.
, 유일한 문제 : 당신이 association_id와 모델을 저장하는 행동을 만들 제출해야
및 양식 : 당신의 코드는 같아야합니다 새 회원을 제출하기 위해 양식에 액세스 할 때 자동으로 회원을 만드는 것입니다. 자동으로 생성되는 '멤버'를 데이터베이스에 저장하는 것을 멈추게하면됩니다. –