[Rails-core] Re: Eager loading optimization patch

2007-10-28 Thread Frederick Cheung
On 29 Oct 2007, at 01:39, Mark Reginald James wrote: > > 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:#con

[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: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Rick Olson
On 10/28/07, Danny Burkes <[EMAIL PROTECTED]> wrote: > > > Do you wanna whip up a patch with the right UTF codes? > > > > Sure, happy to do it, but is there something wrong with the latest patch > attached to http://dev.rubyonrails.org/ticket/9975 ? Does it go a bit > too far? Seems to work for

[Rails-core] Re: Accepting JSON in requests

2007-10-28 Thread Rick Olson
> The last patch submitted against the ticket allows you to do this: It just doesn't feel right to me to depend on your controller name for this. Let's try this as a plugin for now and give it a chance to live in the wild. If this works out for folks writing JSON APIs, we can look at including

[Rails-core] Re: Overriding ActiveRecord::Base private methods

2007-10-28 Thread Mike Barsalou
On Oct 27, 9:52 pm, snacktime <[EMAIL PROTECTED]> wrote: > On Oct 26, 5:55 pm, "Michael Koziarski" <[EMAIL PROTECTED]> wrote: > > > > I'm struggling a bit with the best way to override the private create > > > and update methods. I have an adapter for a non sql backend and I > > > need to eithe

[Rails-core] Re: Adding see_other method to ActionController

2007-10-28 Thread Michael Koziarski
On 29/10/2007, at 8:57 AM, Hongli Lai <[EMAIL PROTECTED]> wrote: > > On Oct 28, 6:59 pm, Rick Olson <[EMAIL PROTECTED]> wrote: >> I think that's reasonable... >> >> Also, perhaps redirect_to with an activerecord model could assume a >> 303? >> >> redirect_to foo_path # 301 >> redirect_to @fo

[Rails-core] Re: Adding see_other method to ActionController

2007-10-28 Thread Hongli Lai
On Oct 28, 6:59 pm, Rick Olson <[EMAIL PROTECTED]> wrote: > I think that's reasonable... > > Also, perhaps redirect_to with an activerecord model could assume a > 303? > > redirect_to foo_path # 301 > redirect_to @foo # 303 > > The fact that browsers don't redo the post when reloading sounds like

[Rails-core] Re: Eager loading optimization patch

2007-10-28 Thread Tarmo Tänav
Looks interesting. I don't have time to test this but have you tried to eager load several has_many associations at once (so there are M*N result rows) and compare the memory consumption of the new approach with the old one? On P, 2007-10-28 at 18:34 +, Pratik wrote: > Hi, > > I've uploaded

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Danny Burkes
> Do you wanna whip up a patch with the right UTF codes? > Sure, happy to do it, but is there something wrong with the latest patch attached to http://dev.rubyonrails.org/ticket/9975 ? Does it go a bit too far? - D -- Posted via http://www.ruby-forum.com/. --~--~-~--~~--

[Rails-core] Eager loading optimization patch

2007-10-28 Thread Pratik
Hi, 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) unless collection.target.incl

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Rick Olson
> I like that- it's worth mentioning that the non-compliance issue I'm > having is with non-browsers choking on the to_json output, not browsers. > So distinguishing between the two seems like a good compromise, if we > need one. I don't... But we don't do that for HTML so I'm not sure we have t

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Danny Burkes
> One thing to consider, too, is that this only affects JSON posted on a > web page, not sent between requests. Perhaps there's something like > the html_encode helper for JSON: > > <%= j @foo.to_json %> > I like that- it's worth mentioning that the non-compliance issue I'm having is with non-

[Rails-core] Re: Looking for comments on a rails patch, lazy association instantiation)

2007-10-28 Thread Rick Olson
On Oct 28, 12:43 pm, "Rick DeNatale" <[EMAIL PROTECTED]> wrote: > Thanks to a great suggestion by Josh Susser. I've spent the past two > days completely re-working the code I submitted in the eariler patch. > > The new patch;http://dev.rubyonrails.org/ticket/10012 > accomplishes the same result

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Rick Olson
> If we can be comfortable we're not introduce a security regression, > then we can down to the talk about how we encode those values, > whether it's sane to assume utf-8 encoded strings, and all that other > good stuff :) One thing to consider, too, is that this only affects JSON posted on a web

[Rails-core] Re: Adding see_other method to ActionController

2007-10-28 Thread Rick Olson
On Oct 28, 5:01 am, Hongli Lai <[EMAIL PROTECTED]> wrote: > On Oct 28, 11:02 am, "Michael Koziarski" <[EMAIL PROTECTED]> > wrote: > > > As was mentioned by others, you should really be sending 201, so I'm > > not even sure this is an issue that merits changing the documentation. > > I realise

[Rails-core] Re: Looking for comments on a rails patch, lazy association instantiation)

2007-10-28 Thread Rick DeNatale
Thanks to a great suggestion by Josh Susser. I've spent the past two days completely re-working the code I submitted in the eariler patch. The new patch; http://dev.rubyonrails.org/ticket/10012 accomplishes the same results, but with a much better api. The earlier patch added a new option for u

[Rails-core] Re: Utility that checks outdated patches

2007-10-28 Thread mikong
Thanks :) On Oct 25, 9:37 am, Pratik <[EMAIL PROTECTED]> wrote: > It's a hack done in few hours. No one dare to laugh ;-) > > http://tools.assembla.com/svn/corefun > > On 10/25/07, mikong <[EMAIL PROTECTED]> wrote: > > > > > > > I was actually thinking of limiting the script to check only the > >

[Rails-core] Re: Adding see_other method to ActionController

2007-10-28 Thread Hongli Lai
On Oct 28, 11:02 am, "Michael Koziarski" <[EMAIL PROTECTED]> wrote: > As was mentioned by others, you should really be sending 201, so I'm > not even sure this is an issue that merits changing the documentation. > I realise browsers don't support 201 but that's why we have > respond_to Seeing t

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Michael Koziarski
> All I'm advocating for is valid JSON- I thought that was the Core team's > position now as well, since they finally addressed the key-quoting issue > in http://dev.rubyonrails.org/changeset/7697 > > Am I wrong about that? No, you're not wrong. All I'm looking for is for people to report that t

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Danny Burkes
> You're welcome to whatever philosophy you choose to hold to, but > unless this change will also address the security issue identified, > it's a complete non-starter ;) > Of course < and > should be encoded- but they should be encoded per the spec, as \u003C' and '\u003E', respectively. They

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Michael Koziarski
> If the current core philosophy is that to_json should always generate > spec-valid JSON (as evidenced by > http://dev.rubyonrails.org/changeset/7697), then > http://dev.rubyonrails.org/changeset/6893, which caused this problem, > was contrary to that philosophy. You're welcome to whatever philo

[Rails-core] Re: Adding see_other method to ActionController

2007-10-28 Thread Michael Koziarski
> First, thanks for the redirect_to patch. I started with that originally. > Again because this is a common use case, I figured we need to address it in > the framework, and it looked to me like the low hanging fruit is submitting > a documentation patch. Documenting this means teaching people

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Danny Burkes
> http://dev.rubyonrails.org/changeset/7697), then > http://dev.rubyonrails.org/changeset/6893, which caused this problem, > was contrary to that philosophy. > Damn encoder :-) That's http://dev.rubyonrails.org/changeset/6893 - D -- Posted via http://www.ruby-forum.com/. --~--~-~-

[Rails-core] Re: JSON encoder shouldn't encode "<" and ">" as octals but

2007-10-28 Thread Danny Burkes
> So, back to the issue at hand, which is that the string encoder for > ActiveSupport::JSON converts "<" and ">" to '\074' and '\076', when it > should actually be encoding them as '\u003C' and '\u003E'. > +1 If the current core philosophy is that to_json should always generate spec-valid JSON