Forum: Ruby on Rails Problem updating sqlite database with active record

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B5be622d0a3cefc2c59f44935fcb433d?d=identicon&s=25 Mark Fraser (mark6139)
on 2009-01-11 23:34
I am trying to use active record outside of rails using sqlite3-ruby (on
OSX Tiger).  This worked find with ruby 1.8.

After installing Ruby 1.9 using MacPorts (and installing rails and
sqlite-ruby gem) I am getting an error (trace below) whenever I try to
save changes (just retrieving works fine).

Any help would be appreciated.


-------

require 'active_record'

ActiveRecord::Base.establish_connection(
  :adapter => "sqlite3",
  :dbfile => '/Users/mark/development/projects/hhparser/db/test.tmp.db'
)

class GameType < ActiveRecord::Base
end

ActiveRecord::Base.logger = Logger.new(STDOUT)

gt = GameType.find(:first)
gt.description = "tempdesc"
gt.save

---------------------


/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:442:in
`rescue in load_missing_constant': uninitialized constant
ActiveSupport::Multibyte (NameError)
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:438:in
`load_missing_constant'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in
`const_missing_with_dependencies'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/quoting.rb:11:in
`quote'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:2825:in
`quote_value'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:2711:in
`update'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/locking/optimistic.rb:70:in
`update_with_lock'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/dirty.rb:146:in
`update_with_dirty'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:253:in
`update_with_callbacks'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/timestamp.rb:38:in
`update_with_timestamps'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:2699:in
`create_or_update'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/callbacks.rb:222:in
`create_or_update_with_callbacks'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/base.rb:2383:in
`save'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/validations.rb:1009:in
`save_with_validation'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/dirty.rb:79:in
`save_with_dirty'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:179:in
`block in with_transaction_returning_status'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
`transaction'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in
`transaction'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:138:in
`transaction'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:178:in
`with_transaction_returning_status'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in
`block in save_with_transactions'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:158:in
`rollback_active_record_state!'
        from
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-2.2.2/lib/active_record/transactions.rb:146:in
`save_with_transactions'
        from ar_test.rb:18:in `block in <main>'
        from ar_test.rb:15:in `each'
        from ar_test.rb:15:in `<main>'
This topic is locked and can not be replied to.