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>
wrote:
> hi,
>
> I am doing unit testing. I have a table as SalesOrder, where
> "ordernumber" is the primary key of the table. When I insert records in
> the table from unit testing, I got error like,
>
>  ActiveRecord::RecordNotFound: Couldn't find SalesOrder without an ID
>
> But, I have fixed the error by adding set_primary_key "ordernumber" in
> the model, and tested the unit test class and works well. But, If I
> insert record from the application as SalesOrder.save, I got the same
> error. If I comment the line set_primary_key in the model, then the
> application works fine, but unit testing fails with this error.
>
> Is there any alternative way, where unit test and application accepts?
>
> Thank you
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to