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).
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)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With