Getting Things Done with Active Record

Mike Clark has a great article on how to dig deeper into Active Record by using acts_as_nested_set and find_by_sql. On the notion of using SQL in an OO model, he writes:

Some may think this breaks object purity. I think it’s just productive. After all, I know there’s a database under there, and SQL is incredibly powerful for querying relational data. Most of the time I’d rather not write SQL because I’m doing CRUD operations. In those cases, Active Record intervenes to boost my productivity. And when SQL is the best tool for the job, Active Record gets out of the way to let me be most productive.

I couldn’t agree more. SQL is not bad at all. Once you take out the repetition for the simple cases, you’re left with a very powerful query language for the hard cases.

blog comments powered by Disqus