i create a new model(User) and create a new record (User.create(attributes)) in oracle when i check User.find 1 in console it gives record not found error when i try User.find(:first).id --> 10000 how to change this starting id into 1 .... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 11, 10:58 am, Pokkai Dokkai <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> i create a new model(User) and create a new record > (User.create(attributes)) in oracle > when i check User.find 1 in console > it gives record not found error > > when i try > User.find(:first).id --> 10000 > > how to change this starting id into 1 ....The following lines are in oracle_adapter.rb def create_table(name, options = {}) #:nodoc: super(name, options) seq_name = options[:sequence_name] || "#{name}_seq" execute "CREATE SEQUENCE #{seq_name} START WITH 10000" unless options[:id] == false end I don''t know why they decided to hard-code the 10000 in there. It would be nice if you could override it. I suggest submitting an enhancement request to the ruby-oci8 maintainer. A simple patch would be def create_table(name, options = {}) #:nodoc: super(name, options) seq_name = options[:sequence_name] || "#{name}_seq" start_num = options[:start_with] || 10000 execute "CREATE SEQUENCE #{seq_name} START WITH #{start_num}" unless options[:id] == false end assuming the class chain starting with ActiveRecord::Migration passes all the options through. In the mean time you could monkey patch the class with the above method yourself. Mark. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---
> I don''t know why they decided to hard-code the 10000 in there. It > would be nice if you could override it. I suggest submitting an > enhancement request to the ruby-oci8 maintainer. A simple patch would > be > > def create_table(name, options = {}) #:nodoc: > super(name, options) > seq_name = options[:sequence_name] || "#{name}_seq" > start_num = options[:start_with] || 10000 > execute "CREATE SEQUENCE #{seq_name} START WITH > #{start_num}" unless options[:id] == false > end > > Mark.thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---