Saturday, January 20, 2007

Canada Duane FTW

As far as I can tell, every Rails app on earth already uses his paginate_collection code. Now he has a Rails plugin for generating complex and/or conditions in SQL based on conditional flow control in Ruby.

Basically it allows you much, much more granular control over your queries than standard Rails methods, in a much, much more maintainable way than the usual hard-coded ':conditions => "this AND that OR the_other_thing"' SQL strings. Instead of generating the strings conditionally, you generate the conditions themselves, and the plugin builds the actual SQL. Not only more maintainable, therefore, but also potentially more portable as well.

A very, very good idea.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.