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 -- 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 9 Apr 2011, at 03:11, fAisAl <faisal.h.m.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> 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 > > -- > 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. >-- 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.
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 On Apr 9, 3:13 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9 Apr 2011, at 03:11, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > > 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 > > > -- > > 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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 9 Apr 2011, at 07:19, fAisAl <faisal.h.m.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> > Cheers, > Faisal > > On Apr 9, 3:13 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On 9 Apr 2011, at 03:11, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> 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 >> >>> 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 >> >>> -- >>> 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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. >-- 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.
Thank you Fred for your suggestion. I might leave that at end when no other available solutions. Faisal On Apr 9, 3:44 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9 Apr 2011, at 07:19, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > > > > Cheers, > > Faisal > > > On Apr 9, 3:13 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > >> On 9 Apr 2011, at 03:11, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> 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 > > >>> 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 > > >>> -- > >>> 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. > >>> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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 Sat, Apr 9, 2011 at 2:07 AM, fAisAl <faisal.h.m.h-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you Fred for your suggestion. I might leave that at end when no > other available solutions. > >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. -- 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.
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 On Apr 10, 12:25 am, Bryan Crossland <bacrossl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Apr 9, 2011 at 2:07 AM, fAisAl <faisal.h....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thank you Fred for your suggestion. I might leave that at end when no > > other available solutions. > > 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.-- 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.