티켓을 보류 중이거나 읽지 않은 상태로 회신 할 수있는 티켓 시스템이 있습니다. 이들은 '상태'라고하는 다른 모델에 저장되며, 각 상태는 직접 데이터베이스를 시드하여 수동으로 만들어야합니다.상태를 추적하는 "올바른"방법은 무엇입니까?
sudocode :
//database is seeded and creates various statuses
ticket.new(params here)
ticket.save!
//ticket status automatically set in before_create
//status = Status.find(1);
ticket.status.description //'unread' to start
I post on it, ticket updates to replied
//ticket status automatically set in before_update
//status = Status.find(3);
ticket.status.description //'replied'
하지만 티켓이 자동으로 업데이트 할 때 오류 무리가 와서이 상태의 데이터베이스 (예 : 공장 시험에서와 같이) 시드되지 않았기 때문에이 나쁘다. "옳은"방법으로 이것을 설정하는 것이 무엇입니까? ... 정확히 ...
가
왜'status'는'ticket' 테이블의 컬럼이 아닌 별도의 테이블에 있습니까? –
내 코드가 아님 - 우리가 학생들에게 위임 한 대학 학기 프로젝트로 시작됨 ... 나는 주정부가 미리 정해져 있기 때문에 그들이 생각한 것으로 추정한다. – MidnightDemon