Couldn't find SalesOrder without an ID

Vishnu,

What's wrong with using "ID" as the primary key instead of "ordernumber"? I would strongly advise doing so; you will most likely save yourself (and others) current and future headaches by adopting this practice.

Best regards, Sebastian

Sebastian von Conrad wrote:

Vishnu,

What’s wrong with using “ID” as the primary key instead of

“ordernumber”? I would strongly advise doing so; you will most likely

save yourself (and others) current and future headaches by adopting

this practice.

Best regards,

Sebastian

On Oct 31, 4:15�pm, Vishnu First rails-mailing-l...@andreas-s.net

Sebastian,

Thank you for your reply. Its right to keep “ID” as primary key. But, my

client requirement is to keep the “ordernumber” as primary key. So, I am

trying to fix with this.

Thank you

The id field is really used for database record management and it tends to

be a read-only field after the model instance is created. What happens when

the format of the order number changes? You might want to read and fully

understand the consequences by reading section 18.3 of AWDwR 3ed.

Good luck,

-Conrad