gregg-+7pv9bBeZkoOi5MzEVbBygC/G2K4zDHf@public.gmane.org
2006-Nov-06 22:33 UTC
Eager Finder SQL
Hi, I just uploaded a Rails plugin that allows you to specify custom SQL when doing a find with associations (AKA eager loading). One of the problems I encountered when implementing the Chacha Underground (http://underground.chacha.com) was being able to use queries provided by the DBA to efficiently get all the informaion I needed to render a page. In some cases, I needed to go two or three associations deep in a model and the SQL generated by ActiveRecord was either inadequate or lead to huge result sets. My solution was to create a mixin that allowed my to specify a :finder_sql option to the find method. In conjunction with the :column_mapping option, I could then have full control of the queries generated and reduce the number and overhead of the queries needed to render a page. Please check out my blog entry on it for a fuller description: http://kellogg-assoc.com/articles/2006/11/05/eager-finder-sql. Gregg Kellogg --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That looks pretty awesome - I''ve felt the need for something like this several times in the past. Thanks! Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi> Please check out my blog entry on it for a fuller description: > http://kellogg-assoc.com/articles/2006/11/05/eager-finder-sql. >Wow. Fantastic. I have had to write some very complicated custom SQL queries for a project and this looks like a great way for me to get the results back into the OO model! If this works the way it appears to then it should definitely become part of core Rails...! Ed W --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---