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.

James Le Cuirot's latest activity

Monday, May 18 2009
2348 Eager loading does not scope was updated in Ruby on Rails
  • James Le Cuirot
    • Title changed from Eager loading does not respect default_scope to Eager loading does not scope
    by James Le Cuirot at 9:36 PM

    Pratik, please read the rest of the ticket. This isn't just about default_scope. The title is actually misleading and I will now change it. Note in particular t...

Friday, May 01 2009
643 named_scope with eager loading affects activerecord objects was updated in Ruby on Rails
Friday, March 27 2009
2348 Eager loading does not respect default_scope was updated in Ruby on Rails
  • James Le Cuirot
    James Le Cuirot commented at 6:08 PM

    I was going to say I forgot to tackle construct_finder_sql_for_association_limiting but it turns out I didn't need to. It already works with the above patch.

  • James Le Cuirot
    James Le Cuirot commented at 3:05 PM

    Here's a patch with a test for the non-preloading case. This one is less pretty because with_scope is awkward to work with. I suppose I could have split it out ...

  • James Le Cuirot
    James Le Cuirot commented at 11:08 AM

    This may be even more serious than I thought. I haven't tried it but it appears that my with_scope example above would have worked in Rails 2.2. The change in b...

2359 with_scope doesn't need &block parameter was created in Ruby on Rails
  • James Le Cuirot
    James Le Cuirot created the ticket at 3:24 PM

    I gather that adding a &block parameter to your method signature can impact performance. In the case of with_scope, the parameter actually isn't used so it shou...

2189 count breaks has_many through association collection with named scope was updated in Ruby on Rails
  • James Le Cuirot
    James Le Cuirot commented at 2:12 PM

    Sorry. Stupid Markdown...

    I hit a very similar issue, which I reported in ticket #2329. As well as having .* in :select, I also had a calculated column, hence t...

  • James Le Cuirot
    James Le Cuirot commented at 2:11 PM

    I hit a very similar issue, which I reported in ticket #2329. As well as having . in :select, I also had a calculated column, hence there was a comma in there. ...

Thursday, March 26 2009
2348 Eager loading does not respect default_scope was updated in Ruby on Rails
  • James Le Cuirot
    James Le Cuirot commented at 3:59 PM

    I've thought about it some more and an easy workaround is to duplicate the default_scope in the association definition like so.

    
    class Tag < ActiveRecord::Bas...
  • James Le Cuirot
    James Le Cuirot commented at 3:18 PM

    Actually the problem goes deeper. This doesn't work either.

    
    Tagging.send(:with_scope, :find => { :conditions => { :enabled => true } }) do
      Tag.first(:incl...