I could use some eyes on 
https://rails.lighthouseapp.com/projects/8994/tickets/4368
if anyone has the time.

Summary of the change:

Similar to PredicateBuilder's existing support for 'table.column' =>
'value', this patch enables 'column#method' => 'value'.

For instance, Article.where('title#matches' => 'Hello%') generates SQL
like:

SELECT "articles".* FROM "articles" WHERE ("articles"."title" LIKE
'Hello%')

Among other things, this change would prevent it from being necessary
to resort to SQL strings in order to achieve something as simple as a
a "published_at is not null" where clause.

  Article.where('published_at#noteq' => nil).to_sql
  SELECT "articles".* FROM "articles" WHERE ("articles"."published_at"
IS NOT NULL)

It plays nicely with scopes:

  scope :published, where('published_at#noteq' => nil)

In general, I don't see a whole lot of downsides to this... One thing
that could perhaps be improved is the elimination of quote
requirements around hash keys by method_missing on Symbol
(:table.column), and an operator for method selection
-- :column/:method maybe? I don't know, that syntax looks a bit goofy,
too. I chose the # of its relationship to Object#method. Most likely
for the same reasons the new routing strings were chosen.

Thanks,
   Ernie

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

Reply via email to