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.
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.
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.
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.
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.