On Mon, Feb 18, 2013 at 10:58:05PM -0500, Tim Pope wrote:
> This seems like such an obvious idea that I'm having trouble believing
> I'm the first to think of it. Why not take ranges containing
> Float::INFINITY and translate them to the appropriate greater than or
> less than comparisons? Example:
> 
> class Person
>    scope :voters, -> { where(born_on: (-Float::INFINITY..18.years.ago)) }
> end
> 
> This would generate something along the lines of "WHERE people.born_on
> <= '1995-02-19'".
> 
> A proof of concept implementation was easy to knock out:
>     
> https://github.com/tpope/rails/commit/b98545a930546854ddf401edfaad4a3a4860aeff
> 
> This seems like a intuitive, unobtrusive way to make some comparison
> operators available without dropping down to SQL.  Tell me why I'm
> wrong.

You're wrong because you didn't add any tests. ;-)

-- 
Aaron Patterson
http://tenderlovemaking.com/

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to