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 …
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 …
On Jun 11, 10:58 am, Pokkai D. [email protected]
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 errorwhen i try
User.find(:first).id → 10000how 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.
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
bedef 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
endMark.
thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs