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.

Neeraj Singh's latest activity

Saturday, November 13 2010
5958 Collection rendering with superfluous database queries was updated in Ruby on Rails
  • Neeraj Singh
    Neeraj Singh commented at 5:23 PM

    @Santiago

    I tested your patch and it works great. Great solution. Thanks for teaching.

Friday, November 12 2010
5884 Rendering a partial with an array as its :object should not render as :collec... was updated in Ruby on Rails
  • Neeraj Singh
    • State changed from new to resolved
    by Neeraj Singh at 7:46 PM
5958 Collection rendering with superfluous database queries was updated in Ruby on Rails
  • Neeraj Singh
    Neeraj Singh commented at 7:03 PM

    My previous patch reduced the number of sql queries from 3 to 2.

    Then new attached patch is reducing the number of sql queries from 3 to 1.

  • Neeraj Singh
    Neeraj Singh commented at 6:57 PM

    You are right. It should be .length. I usually avoid length because it does select and not select count but in this case if the number of records is more than o...

  • Neeraj Singh
    Neeraj Singh commented at 5:38 PM

    That's what I was saying. May be I was not clear enough.

    This blog has more info on the same topic with greater clarity http://blog.hasmanythrough.com/2008/2/27...

  • Neeraj Singh
    • Assigned user set to Santiago Pastorino
    by Neeraj Singh at 4:55 PM

    When the execution comes to @collection, at that time @collection is a Relation and that is not loaded. Since it is not loaded whether you call .length or .size...

  • Neeraj Singh
    • Tag set to patched
    by Neeraj Singh at 4:23 PM

    Attached is code patch. Not sure how to count how many sql statements have been generated in the whole view.

5932 Additional attributes on select don't appear. was updated in Ruby on Rails
  • Neeraj Singh
    Neeraj Singh commented at 6:39 PM

    Can you post model with scope so that I could reproduce the problem. Thanks

5945 after_save callbacks are called before dirty tracking is updated was updated in Ruby on Rails
  • Neeraj Singh
    • Assigned user set to José Valim
    by Neeraj Singh at 5:40 PM

    Assigning it to Mr. Valim because the question has more to do with historical context. And he has been around a long time :-)

5952 :inverse_of does not apply to association extensions was updated in Ruby on Rails
  • Neeraj Singh
    • Importance changed from to Low
    by Neeraj Singh at 11:57 AM

    Which version of rails you are using?