Problem with set_sequence_name please help

I’m building rails 3 with legacy oracle 10g db. which it’s sequence is
non rails convension.

I have try this.

class AdCourt < ActiveRecord::Base
set_sequence_name ‘COURT_SEQ’
end

with rails console :

AdCourt.sequence_name I have got “COURT_SEQ” which look ok.

When

AdCourt.create!(:caption => ‘AAAA’, :code => ‘1111’, :version => 0,
:created_by_id => 0)

it’s still using “ad_courts_seq” which not exist.

ActiveRecord::StatementInvalid: ActiveRecord::ActiveRecordError:
ORA-02289: sequence does not exist
: select ad_courts_seq.nextval id from dual
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:202:in
log' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:582:inexecute’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_oracle.rb:390:in
select' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:578:inselect_one’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-jdbc-adapter-0.9.7-java/lib/jdbc_adapter/jdbc_oracle.rb:163:in
insert' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/engines/sql/engine.rb:30:increate’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/algebra/relations/writes.rb:24:in
call' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/session.rb:17:increate’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/arel-1.0.1/lib/arel/algebra/relations/relation.rb:159:in
insert' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/relation.rb:14:ininsert’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/persistence.rb:271:in
create' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/timestamp.rb:47:increate’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281:in
create' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428:in_run_create_callbacks’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:281:in
create' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/persistence.rb:247:increate_or_update’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
create_or_update' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activesupport-3.0.0/lib/active_support/callbacks.rb:428:in_run_save_callbacks’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/callbacks.rb:277:in
create_or_update' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/persistence.rb:56:insave!’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/validations.rb:49:in
save!' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/attribute_methods/dirty.rb:30:insave!’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/transactions.rb:242:in
save!' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/transactions.rb:289:inwith_transaction_returning_status’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in
transaction' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/transactions.rb:204:intransaction’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/transactions.rb:287:in
with_transaction_returning_status' from /Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/transactions.rb:242:insave!’
from
/Users/cyberjom/.rvm/gems/jruby-1.5.2/gems/activerecord-3.0.0/lib/active_record/validations.rb:34:in
`create!’

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs