need help with oracle adapter

Hi all, I have been struggling with this problem for a while. I cannot insert into a table (simple action) with auto-increment mechanism.

I have got: rvm with ruby 1.8.7 gem -v is: 1.6.2 rails -v is" 3.0.5 ruby-oci8 1.0.6 activerecord-oracle-adapter, not the enhanced one, the version I used is 1.0.0.9250.

all above versions are required.

I created a table " programs" with primary key id. I also created a sequence for auto-increment. : programs_seq I also created a trigger before insert into that table: programs_trigger

The table name is programs, therefore, the model name is program

class Program < ActiveRecord::Base   set_primary_key "id"   set_sequence_name "programs_seq" end

when i try to insert into that table via sqlplus is works, but when I use rails console I could not, it gives me along errors or exceptions with primary key,

First part of the errors: NoMethodError: undefined method `primary_key' for #<ActiveRecord::ConnectionAdapters::OracleAdapter:0xb728b434> ....

It is very long message, sorry about that.

Please help, I searched for a solution but with no luck. any help will be appreciated.

Cheers, Faisal

Hi all, I have been struggling with this problem for a while. I cannot insert into a table (simple action) with auto-increment mechanism.

I have got: rvm with ruby 1.8.7 gem -v is: 1.6.2 rails -v is" 3.0.5 ruby-oci8 1.0.6 activerecord-oracle-adapter, not the enhanced one, the version I used is 1.0.0.9250.

Have you tried the enhanced one? I seem to recall that is the actively maintained one.

Fred

Thank you Fred, Yes I could have used that, but as a requirement from host, I must use the old adapter not the enhanced one.

Cheers, Faisal

Thank you Fred, Yes I could have used that, but as a requirement from host, I must use the old adapter not the enhanced one.

You'll probably need to use an older version of rails (ie 2.x) then

Fred

Thank you Fred for your suggestion. I might leave that at end when no other available solutions.

Faisal

activerecord-oracle-adapter’s last official version of Rails it worked with was Rails 2 (2.1 if I recall correctly). It was replaced years ago by activerecord-oracle_enhanced-adapter which works with Rails 2.3.* and Rails 3. If you wish to use the older adapter you are going to have to use an earlier version of Rails 2. I would suggest you tell your host to get with the times and install activerecord-oracle_enhanced-adapter. If they refuse then you are stuck with having to use an older version of Rails 2. At that point I would seriously consider switching hosting providers.

B.

Thank you for you help Bryan, I am very satisfied by our answer. I will try to tell my host that to upgrade their environment.

Thank for all who tried to help and also thanks for Fred for early answer.

Cheers all, Faisal