What exactly is Arel in Rails 3.0?

前端 未结 4 1823
旧时难觅i
旧时难觅i 2020-12-12 09:26

I understand that it is a replacement for ActiveRecord and that it uses objects instead of queries.

But...

why is this better?

will objects/queries

4条回答
  •  执念已碎
    2020-12-12 10:11

    ARel, is unfortunately tied directly to generating SQL and thus is unsuitable for DataMapper's needs.

    The way I would put it is that ARel is an explicit query model for ActiveRecord that generates and optimizes SQL queries for RDBMSes.

    DataMapper on the other hand is a genuine mapper for data, and can interface with non-relational data stores already. In the future DataMapper is likely to include a separate library called Veritas, which is intended to provide relational functionality to data sourced from ANY data store, not just RDBMSes.

提交回复
热议问题