[Rails-core] proxy_options on named scopes

2010-04-09 Thread Matt Jankowski
It looks like a recent documentation commit finally removed references to this method... http://github.com/rails/rails/commit/c6372d604952a8eef16ce73a06814aa143b94779 In lieu of having #proxy_options available, is there another method which replaces that functionality (access to a hash of all the

[Rails-core] Re: Unary and Polyadic predicates, notin and notmatch predicates for Arel

2010-04-09 Thread Ernie Miller
> I agree that I don't much like the way it just dangles there like > that, but I don't see any other way to accomplish what's desired. In > working with it, I find that it helps to imagine yourself back in the > 90s for a moment. > > "User name equals Bill or user name equals Ted... NOT!" > > OK,

Re: [Rails-core] Re: Introducing Object#self

2010-04-09 Thread Nicolás Sanguinetti
On Fri, Apr 9, 2010 at 4:31 PM, Joao Carlos wrote: > I'll admit mine was a bad example. However, the most common (only?) > use case I could see for it is in fact with #send. > > Your idea for filtering is great, by the way. Instead of send you can use instance_eval. Where you'd do something like

[Rails-core] Re: Introducing Object#self

2010-04-09 Thread Joao Carlos
I'll admit mine was a bad example. However, the most common (only?) use case I could see for it is in fact with #send. Your idea for filtering is great, by the way. On Apr 9, 9:19 pm, Mislav Marohnić wrote: > On Fri, Apr 9, 2010 at 13:26, Joao Carlos wrote: > > > filter = %w(with_votes without_

Re: [Rails-core] Introducing Object#self

2010-04-09 Thread Mislav Marohnić
On Fri, Apr 9, 2010 at 13:26, Joao Carlos wrote: > > filter = %w(with_votes without_votes).include?(params[:filter]) ? > params[:filter].to_sym : :self > Idea.published.send(filter).all I wouldn't call this use case where it would be "extremely handy". Here is better code for it: filters =

[Rails-core] [PATCH] add :root option to ActiveModel JSON serialization

2010-04-09 Thread James MacAulay
This is a small, straightforward patch that I'd love to see merged: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4358-patch-add-root-option-to-activemodel-json-serialization It's all pretty self-explanatory, it basically just ports a useful option from to_xml to to_json, ma

Re: [Rails-core] [patch] fix tidy_bytes for 1.9.x, improve performance

2010-04-09 Thread Jeremy Kemper
On Fri, Apr 9, 2010 at 6:05 AM, Norman Clarke wrote: > Hi all, > > I was wondering if I could get some feedback on a patch I created for > ActiveSupport's `tidy_bytes` method. > > Right now `tidy_bytes` doesn't work with 1.9.x, since it relies on a > Unicode regexp that always fails for strings wi

[Rails-core] Rails 3 Deprecations

2010-04-09 Thread Steve Downie
I'm working my way through the transition from Rails 2 to Rails 3 and I came across the DEPRECATION warnings that we all will start seeing real soon. These are currently implemented as shortcuts to constants, but to bring your code up to date and eliminate deprecation concerns, they should all be c

[Rails-core] open source coders forum

2010-04-09 Thread Harsha
Hello world… We just released the beta version of a new platform for cooperation between coders, programmers and developers – based on an open source model. We would be pleased if as many of you take some time, test the initial functions and provide us feedback! You can find the website at: http://

[Rails-core] [patch] fix tidy_bytes for 1.9.x, improve performance

2010-04-09 Thread Norman Clarke
Hi all, I was wondering if I could get some feedback on a patch I created for ActiveSupport's `tidy_bytes` method. Right now `tidy_bytes` doesn't work with 1.9.x, since it relies on a Unicode regexp that always fails for strings with invalid UTF-8 characters. You can see the essence of the proble

Re: [Rails-core] Introducing Object#self

2010-04-09 Thread Nicolás Sanguinetti
On Fri, Apr 9, 2010 at 10:10 AM, Anuj Dutta wrote: > > > On 9 April 2010 16:56, Joao Carlos wrote: >> >> I just came across a situation where it would be extremely handy to >> have a method that returns the receiver. >> >> Imagine the following example: >> >> filter = %w(with_votes without_votes)

[Rails-core] Re: Introducing Object#self

2010-04-09 Thread Joao Carlos
Object#tap needs a block. Joao On Apr 9, 4:10 pm, Anuj Dutta wrote: > On 9 April 2010 16:56, Joao Carlos wrote: > > > > > > > I just came across a situation where it would be extremely handy to > > have a method that returns the receiver. > > > Imagine the following example: > > > filter = %w(w

Re: [Rails-core] Introducing Object#self

2010-04-09 Thread Ryan Bigg
Very similar. tap will yield the block passed to it then return self: def tap yield self self end On 9 April 2010 23:10, Anuj Dutta wrote: > > > On 9 April 2010 16:56, Joao Carlos wrote: > >> I just came across a situation where it would be extremely handy to >> have a method that returns

Re: [Rails-core] Introducing Object#self

2010-04-09 Thread Anuj Dutta
On 9 April 2010 16:56, Joao Carlos wrote: > I just came across a situation where it would be extremely handy to > have a method that returns the receiver. > > Imagine the following example: > > filter = %w(with_votes without_votes).include?(params[:filter]) ? > params[:filter].to_sym : :self > Id

[Rails-core] Introducing Object#self

2010-04-09 Thread Joao Carlos
I just came across a situation where it would be extremely handy to have a method that returns the receiver. Imagine the following example: filter = %w(with_votes without_votes).include?(params[:filter]) ? params[:filter].to_sym : :self Idea.published.send(filter).all The implementation would be

[Rails-core] Re: Unary and Polyadic predicates, notin and notmatch predicates for Arel

2010-04-09 Thread Ernie Miller
On Apr 8, 9:47 pm, "Joe Smith" wrote: > > That breaks left to right readability pretty badly. I really would like a > better solution for negating predicates and predicate chains, but I'm not > sure what. I agree that I don't much like the way it just dangles there like that, but I don't see an