3 ms·
Check out ARel. (it's in ActiveRecord 3, part of Rails) It uses relational algebra and is pretty good about letting you mix and match: enabled = User.wher
by mnutt 15y ago
Check out ARel. (it's in ActiveRecord 3, part of Rails) It uses relational algebra and is pretty good about letting you mix and match:
enabled = User.where(:disabled => false)
enabled.group("date(created_at)").having("created_at > ?", 1.month.ago).order(weird_order_clause).limit(5)
- dools 15y agoRight, yeah that's pretty nice!
- eropple 15y agoThe CodeIgniter ActiveRecord library follows the same pattern. Unfortunately, it's pretty kludgey and requires you to use CodeIgniter.
- Xurinos 15y agoDo you have an example that shows how to use ARel to do relational algebra?
- mnutt 15y agoI believe it just uses it under the hood, but I'm not familiar enough with relational algebra (or ARel) to know for sure. Here's a blog post from the author: http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/ http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-...