On 4 July 2012 05:23, rocky <asharma...@gmail.com> wrote: > m getting an error "Called id for nil, which would mistakenly be 4 -- if you > really wanted the id of nil, use object_id" > > when i'm creating new record,like a topic has many discussions,when i'm > creating a new discussions m getting that error..i already assign the topic > id as foreign key in discussions controller....please sort out this > problem.if u getting the same..how you rectify those errors..and in how many > cases this errors are prone to occur???
This means that you have some code some_object.id where some_object is nil. The error message should tell you which line is failing. Have a look at the Rails Guide on debugging for ideas on how to debug your code to find the problem. Colin -- 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-US.