Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What might this be: New Active Record chainable query language built on top of relational algebra?

I saw this on a blog today, and I thought, finally! Rails will have something like HQL or Linq. Um, or not. I couldn't find anything about this.

What I really want to know: will I be able to forget what the tables are called and use the object names only? Can I finally forget join syntax? I'd like to do that before I start forgetting everything else (life goals).

like image 239
Dan Rosenstark Avatar asked Feb 05 '10 17:02

Dan Rosenstark


2 Answers

As far as I understand, this means that you can write your complex queries not as

Object.find(:all, :conditions = > { :limit => 10, :offset => 5 }

but more readable way

Object.all.limit(10).offset(5)
like image 156
Vestel Avatar answered Sep 23 '22 04:09

Vestel


Chainable queries with lazy evaluation and the AREL syntax:

This lets you write various scopes representing conditions and then mix and match them and chain them together... in the knowledge the the query will not actually get run until the output is needed ('lazy evaluation').

The syntax of AREL is much closer to standard sql syntax instead of the previous 'rails' syntax so it is easier to use and recognize and maintain for those famiiar with SQL.

like image 33
Michael Durrant Avatar answered Sep 22 '22 04:09

Michael Durrant