[Rails-core] Request for review of STI/eager-loading patch

2008-01-10 Thread Mark Reginald James
Hi, Review would be appreciated on this patch which stops find returning incorrect results when multi-level STI models are eagerly loaded: http://dev.rubyonrails.org/ticket/10624 -- We develop, watch us RoR, in numbers too big to ignore. --~--~-~--~~~---~--~---

[Rails-core] Re: Eager loading optimization patch

2007-10-28 Thread Mark Reginald James
Pratik wrote: > I've uploaded a patch to optimize eager loading, which changes the > code to spend less time in ruby - > http://dev.rubyonrails.org/ticket/10011 > > The problem is because of following line in > associations.rb:#construct_associations : > collection.target.push(association) unles

[Rails-core] Re: included model attribute selection using :symbol[]

2007-08-24 Thread Mark Reginald James
Gabe da Silveira wrote: > He means there's no way to do custom eager loading. Namely, a > find_by_sql (or any find call without :include for that matter) only > ever instantiates models of a single type. There is a much larger class > of performance problems that can be solved by allowing ins

[Rails-core] Re: included model attribute selection using :symbol[]

2007-08-21 Thread Mark Reginald James
Michael Koziarski wrote: > I'm personally not sold on this particular optimisation technique. I > think the real problem here is that it's still too hard to load a > graph of objects out of a find_by_sql call. If that were fixed you'd > be able to optimise cases like this, without too much comp

[Rails-core] Re: included model attribute selection using :symbol[]

2007-08-20 Thread Mark Reginald James
Michael Koziarski wrote: >> Are their other dangers with such a definition that makes >> you uncomfortable? > > I just don't think that the feature justifies adding such strange and > counter-intuitive syntax. I'm all for adding methods to core classes > that aid developers, every day. Things l

[Rails-core] included model attribute selection using :symbol[]

2007-08-18 Thread Mark Reginald James
Ticket 7147, among others, discusses support for restricting attribute selection for finds that do eager-loading. A core team member was not enthusiastic about approaches that required the parsing of :select option SQL, so I've tried another approach in an attempt to get core team support for thi

[Rails-core] Re: slow eager loading ( & fix)

2007-08-11 Thread Mark Reginald James
Gabe da Silveira wrote: > On 8/11/07, *Mark Reginald James* <[EMAIL PROTECTED] wrote: > 2. :select is used to restrict the size of base model data returned > > Unfortunately eager loading ignores the select option. There's a plugin for this now: http://rubyforge.org/pro

[Rails-core] Re: slow eager loading ( & fix)

2007-08-11 Thread Mark Reginald James
Trevor Squires wrote: > 1 - using :include one-level-deep when you are fetching *one* > toplevel object *and* you are not issuing :conditions on > the :included tables is *always* (well, I've never found an > exception) slower. > > x = Foo.find(4678. :include => [:incoming_messages, :outgo

[Rails-core] Re: Support for processing after the response has been transmitted?

2006-12-31 Thread Mark Reginald James
Courtenay wrote: What you mean to say is, no, you shouldn't do it that way :) since it'll tie up the controller. I just thought that for something that doesn't take too long, the simplicity of just adding a "yield" to the action code is attractive. You could fork off a process and detach it

[Rails-core] Support for processing after the response has been transmitted?

2006-12-30 Thread Mark Reginald James
Hi, Is there any interest in allowing controller methods to do post-response processing? This would be useful where some time-consuming statistic or index processing should be done after the response has been sent so as not to delay a response that does not depend on that processing. This coul

[Rails-core] Model.sum returns nil when no rows are selected. Intentional?

2006-08-30 Thread Mark Reginald James
Is it intended that the AR sum method return nil rather than 0 (int) or 0.0 (float) when no rows match the conditions? This is the result I get using MySQL. I can't find any mention of this issue in either Trac or the mailing list archives, so I'll make up a patch if there's confirmation this is

[Rails-core] Move sanitize helper to ActiveSupport?

2006-08-30 Thread Mark Reginald James
I wanted to make an ActiveRecord mod that added a "sanitize_html" function that caused the attributes listed as its parameters to be automatically stripped of dangerous HTML segments through use of ActionView::Helpers::TextHelper.sanitize. It was a bit messy to get working because I had to pull p