This project is archived and is in readonly mode.

#967 ✓invalid
Rene Androsch

Fix for migrations when query_cache is turned on.

Reported by Rene Androsch | September 3rd, 2008 @ 11:35 PM | in 2.x

When I use this in my initializers on Rails 2.1.0 with sqlite3 on MacOSX: ActiveRecord::Base.connection.query_cache_enabled = true I can't run migrations at all.

Here's the output: MacBook:migration_cache_problem art$ rake db:migrate --trace (in /Users/art/development/projects/rails/mine/testbed/migration_cache_problem) Invoke db:migrate (first_time) Invoke environment (first_time) Execute environment Execute db:migrate rake aborted! You have a nil object when you didn't expect it! The error occurred while evaluating nil.has_key? /Users/art/development/projects/rails/mine/testbed/migration_cache_problem/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:91:in cache_sql' /Users/art/development/projects/rails/_mine/testbed/migration_cache_problem/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:74:inselect_all' /Users/art/development/projects/rails/_mine/testbed/migration_cache_problem/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in select_one'

Attached a fix, that ensures, that query_cache is not nil.

Comments and changes to this ticket

  • Pratik

    Pratik December 20th, 2008 @ 05:01 PM

    • State changed from “new” to “invalid”

    ActiveRecord::Base.connection.query_cache_enabled is an attr_reader and you shouldn't need to turn it on as it's always on.

    If you still face the issue, please upload a failing test case.

    Thanks.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages