On Sep 30, 12:22 am, Raimonds Simanovskis
Upon further review it only works if you use TestCountry.new. When I
tried TestCountry.create it failed:
country = TestCountry.create(:code => 'LV', :name => 'Latvia')
country.save!
WARNING: Can't mass-assign these protected attributes: code
SQL (0.0ms) OCIError: ORA-02289: sequence does not exist: SELECT
test_countries_seq.NEXTVAL id FROM dual
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/
connection_adapters/abstract_adapter.rb:219:in `log': OCIError:
ORA-02289: sequence does not exist: SELECT test_countries_seq.NEXTVAL
id FROM dual (ActiveRecord::StatementInvalid)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-
adapter-1.2.2/lib/active_record/connection_adapters/
oracle_enhanced_adapter.rb:1304:in `log'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-
adapter-1.2.2/lib/active_record/connection_adapters/
oracle_enhanced_adapter.rb:1228:in `select'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/query_cache.rb:62:in
`select_all'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/database_statements.rb:
13:in `select_one'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-
adapter-1.2.2/lib/active_record/connection_adapters/
oracle_enhanced_adapter.rb:582:in `next_sequence_value'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/base.rb:2888:in `create_without_timestamps'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/timestamp.rb:53:in `create_without_callbacks'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/callbacks.rb:266:in `create'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/base.rb:2867:in `create_or_update_without_callbacks'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/callbacks.rb:250:in `create_or_update'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/base.rb:2538:in `save_without_validation'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/validations.rb:1078:in `save_without_dirty'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/dirty.rb:79:in `save_without_transactions'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:229:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:229:in
`with_transaction_returning_status'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/connection_adapters/abstract/database_statements.rb:
136:in `transaction'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:182:in `transaction'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:228:in
`with_transaction_returning_status'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:196:in `save'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:208:in `rollback_active_record_state!'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/transactions.rb:196:in `save'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/
active_record/base.rb:723:in `create'
from test.rb:35
Since .create is apparently how fixtures are loaded (makes sense, YAML
returns a hash), this is problematic.
Any suggestions?
Regards,
Dan