Maybe we should fork these kinds of gems into the Rails repo and point them out in the guides? In my view, we'll eventually roll some of these solutions into Rails once they get robust, and used by more people, so let's encourage that!
Yehuda Katz Developer | Engine Yard (ph) 718.877.1325 On Thu, Apr 15, 2010 at 3:38 PM, Ernie Miller <[email protected]> wrote: > Thanks to a discussion with Pratik on #rails-contrib today, I decided > to roll this into a gem instead: > > http://github.com/ernie/meta_where > > Consider the request for feedback on the patch revoked. :) > > Thanks! > > On Apr 12, 5:08 pm, Ernie Miller <[email protected]> wrote: > > I could use some eyes onhttps:// > 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]<rubyonrails-core%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > -- 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.
