Hi all, I am now able to create, update and list object from oracle database (local XE) without any problems. But the destroy method is not working. It is given me this error undefined method `destroy'' for #<Array:0xcbc9b68> I am using ruby 1.8.7 rails 2.3.11 activerecord-oracle-adapter ruby-oci8 1.0.6 Is there setting I should put in corresponding model, like constrains or something. I also added set_table_name and set_primary_key to the model, which has number of has_many relations. Any help will be appreciated. Cheers, Fiz -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 24, 3:21 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > I am now able to create, update and list object from oracle database > (local XE) without any problems. But the destroy method is not > working. > It is given me this error > undefined method `destroy'' for #<Array:0xcbc9b68>Sounds like you''re calling destroy on the wrong thing (probably an array of objects from your db rather than an object itself. Fred> > I am using > ruby 1.8.7 > rails 2.3.11 > activerecord-oracle-adapter > ruby-oci8 1.0.6 > > Is there setting I should put in corresponding model, like constrains > or something. > I also added > set_table_name and set_primary_key to the model, which has number of > has_many relations. > > Any help will be appreciated. > > Cheers, > Fiz-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Fred for your reply. I print the size before destroying the object, it gives me 1. And also I am able to print the content of the object without using .each for looping, thats mean it still object. Before that error, I used to get errors with object id. I named the object primary key as "objectid" in database. The error I used to get is concern not finding id attribute in table. Is it possible to be the problem that I did not follow Activerecord conventions. Cheers, Fiz On Apr 24, 11:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 24, 3:21 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, > > I am now able to create, update and list object from oracle database > > (local XE) without any problems. But the destroy method is not > > working. > > It is given me this error > > undefined method `destroy'' for #<Array:0xcbc9b68> > > Sounds like you''re calling destroy on the wrong thing (probably an > array of objects from your db rather than an object itself. > > Fred > > > > > > > > > > > I am using > > ruby 1.8.7 > > rails 2.3.11 > > activerecord-oracle-adapter > > ruby-oci8 1.0.6 > > > Is there setting I should put in corresponding model, like constrains > > or something. > > I also added > > set_table_name and set_primary_key to the model, which has number of > > has_many relations. > > > Any help will be appreciated. > > > Cheers, > > Fiz-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 24, 4:04 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Fred for your reply. > I print the size before destroying the object, it gives me 1. > And also I am able to print the content of the object without > using .each for looping, thats mean it still object. >I can only guess without seeing what you''re doing, but that really does sound like you''re calling destroy on a collection rather than on an individual object. Fred> Before that error, I used to get errors with object id. > I named the object primary key as "objectid" in database. > The error I used to get is concern not finding id attribute in table. > > Is it possible to be the problem that I did not follow Activerecord > conventions. > > Cheers, > Fiz > > On Apr 24, 11:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > On Apr 24, 3:21 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi all, > > > I am now able to create, update and list object from oracle database > > > (local XE) without any problems. But the destroy method is not > > > working. > > > It is given me this error > > > undefined method `destroy'' for #<Array:0xcbc9b68> > > > Sounds like you''re calling destroy on the wrong thing (probably an > > array of objects from your db rather than an object itself. > > > Fred > > > > I am using > > > ruby 1.8.7 > > > rails 2.3.11 > > > activerecord-oracle-adapter > > > ruby-oci8 1.0.6 > > > > Is there setting I should put in corresponding model, like constrains > > > or something. > > > I also added > > > set_table_name and set_primary_key to the model, which has number of > > > has_many relations. > > > > Any help will be appreciated. > > > > Cheers, > > > Fiz-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you again Fred, I will try to solve the problem and see whether it is a collection or an individual object. Again thank you for your help, I really appropriate it. Cheers, Fiz On Apr 25, 12:34 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 24, 4:04 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Fred for your reply. > > I print the size before destroying the object, it gives me 1. > > And also I am able to print the content of the object without > > using .each for looping, thats mean it still object. > > I can only guess without seeing what you''re doing, but that really > does sound like you''re calling destroy on a collection rather than on > an individual object. > > Fred > > > > > > > > > Before that error, I used to get errors with object id. > > I named the object primary key as "objectid" in database. > > The error I used to get is concern not finding id attribute in table. > > > Is it possible to be the problem that I did not follow Activerecord > > conventions. > > > Cheers, > > Fiz > > > On Apr 24, 11:39 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On Apr 24, 3:21 pm, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi all, > > > > I am now able to create, update and list object from oracle database > > > > (local XE) without any problems. But the destroy method is not > > > > working. > > > > It is given me this error > > > > undefined method `destroy'' for #<Array:0xcbc9b68> > > > > Sounds like you''re calling destroy on the wrong thing (probably an > > > array of objects from your db rather than an object itself. > > > > Fred > > > > > I am using > > > > ruby 1.8.7 > > > > rails 2.3.11 > > > > activerecord-oracle-adapter > > > > ruby-oci8 1.0.6 > > > > > Is there setting I should put in corresponding model, like constrains > > > > or something. > > > > I also added > > > > set_table_name and set_primary_key to the model, which has number of > > > > has_many relations. > > > > > Any help will be appreciated. > > > > > Cheers, > > > > Fiz-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 24 April 2011 16:04, fAisAl <faisal.h.m.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Fred for your reply. > I print the size before destroying the object, it gives me 1.If object.size is 1 then it is probably an array of length 1. size is not defined for a single ActiveRecord object.> And also I am able to print the content of the object without > using .each for looping, thats mean it still object.How are you printing the content of the object? Are you sure it is not displaying with square brackets round it to indicate that it is an array. Colin> > Before that error, I used to get errors with object id. > I named the object primary key as "objectid" in database.I hope your object is not actually of class Object otherwise you will be in trouble I fear.> The error I used to get is concern not finding id attribute in table. > > Is it possible to be the problem that I did not follow Activerecord > conventions.I always advise sticking to the conventions unless there is a good reason for not doing so. You will save yourself grief. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.