README.markdown in arel-4.0.2 vs README.markdown in arel-5.0.0
- old
+ new
@@ -5,11 +5,11 @@
## DESCRIPTION
Arel is a SQL AST manager for Ruby. It
1. Simplifies the generation of complex SQL queries
-2. Adapts to various RDBMS systems
+2. Adapts to various RDBMSes
It is intended to be a framework framework; that is, you can build your own ORM
with it, focusing on innovative object and collection modeling as opposed to
database compatibility and query generation.
@@ -109,16 +109,14 @@
Suppose we have a table `products` with prices in different currencies. And we have a table `currency_rates`, of constantly changing currency rates. In Arel:
```ruby
products = Arel::Table.new(:products)
-products.columns
-# => [products[:id], products[:name], products[:price], products[:currency_id]]
+# Attributes: [:id, :name, :price, :currency_id]
currency_rates = Arel::Table.new(:currency_rates)
-currency_rates.columns
-# => [currency_rates[:from_id], currency_rates[:to_id], currency_rates[:date], currency_rates[:rate]]
+# Attributes: [:from_id, :to_id, :date, :rate]
```
Now, to order products by price in user preferred currency simply call:
```ruby
@@ -137,11 +135,10 @@
```
And this table has the following attributes:
```ruby
-comments.columns
-# => [comments[:id], comments[:body], comments[:parent_id]]
+# [:id, :body, :parent_id]
```
The `parent_id` column is a foreign key from the `comments` table to itself. Now, joining a table to itself requires aliasing in SQL. In fact, you may alias in Arel as well:
```ruby