Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Query Cache not enabled for subsequent connections

#2077

If I do the following

class Foo < ActiveRecord::Base establish_connection(:some_other_db) end

and set a breakpoint in one of my actions, here's what I get:

ActiveRecord::Base.connection.query_cache_enabled => true Foo.connection.query_cache_enabled => false.

Granted, I could do something like put an around filter in application_controller to activate caching on Foo, but it seems like the principle of least surprise would indicate that query cached be enabled for all models regardless of connection

Reported by Andrew Selder · February 25th, 2009 @ 11:47 PM

State: resolved
Milestone: 3.x
Assigned to: Rohit Arondekar Rohit Arondekar
Importance: none

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  2. David Trasbo
    David Trasbo
    • Assigned user set to Ryan Bigg
    • Importance changed from to

    This issue is gone on master:

    ➜  ticket_2077 script/rails g model foo
    ➜  ticket_2077 rake db:migrate
    (in /Users/dtrasbo/code/rails/railties/tmp/ticket_2077)
    
    class Foo < ActiveRecord::Base
      establish_connection(:production)
    end
    
    ➜  ticket_2077 rake db:migrate RAILS_ENV=production
    (in /Users/dtrasbo/code/rails/railties/tmp/ticket_2077)
    ➜  tmp/ticket_2077 script/rails c
    Loading development environment (Rails 3.0.0.beta4)
    ruby-1.9.2-preview3 > ActiveRecord::Base.connection.query_cache_enabled
     => false 
    ruby-1.9.2-preview3 > Foo.connection.query_cache_enabled
     => false
    

    This ticket can be closed.

    July 1st, 2010 @ 07:55 PM

  3. David Trasbo
    David Trasbo
    • Assigned user changed from Ryan Bigg to Rohit Arondekar

    Can be closed, see above.

    September 9th, 2010 @ 08:26 AM

  4. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to resolved

    September 10th, 2010 @ 09:18 AM