ActiveRecord and legacy oracle tables

I’m trying to connect to an existing oracle database. Some tables in
this database do not have a standard “id” field, or any other primary
keys. As I understand it, I can specify which table a model refers
to:

class MyModel < ActiveRecord::Base
set_table_name “t_mymodel”
end

However using this method, I cannot perform a save command on my
model. Attemnpting it yields this error:

ORA-02289: sequence does not exist

I thought by setting the sequence name to an empty string would solve
it:

class MyModel < ActiveRecord::Base
set_table_name “t_mymodel”
set_sequence_name “”
end

But that yields:

ORA-00936: missing expression

Any assistance would be most appreciative

You might have luck with this:
http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas

I’m doing some Rails work with some legacy Oracle tables but right now
I’ve only been reading data and not writing…

Good luck!

Reacher wrote:

I’m trying to connect to an existing oracle database. Some tables in
this database do not have a standard “id” field, or any other primary
keys. As I understand it, I can specify which table a model refers
to:

class MyModel < ActiveRecord::Base
set_table_name “t_mymodel”
end

However using this method, I cannot perform a save command on my
model. Attemnpting it yields this error:

ORA-02289: sequence does not exist

I thought by setting the sequence name to an empty string would solve
it:

class MyModel < ActiveRecord::Base
set_table_name “t_mymodel”
set_sequence_name “”
end

But that yields:

ORA-00936: missing expression

Any assistance would be most appreciative