diff options
author | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2013-12-04 23:33:25 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafael.franca@plataformatec.com.br> | 2013-12-04 23:33:25 -0200 |
commit | a4ddbe4e80dba6840019862dec54748fc8799163 (patch) | |
tree | 95536e64f2318099532b2186ab5cc5c962c35926 | |
parent | 986773ecc6fb6d34b56c45393bcc320b8bd2a66d (diff) | |
download | rails-a4ddbe4e80dba6840019862dec54748fc8799163.tar.gz rails-a4ddbe4e80dba6840019862dec54748fc8799163.tar.bz2 rails-a4ddbe4e80dba6840019862dec54748fc8799163.zip |
Remove columns usage from the README
Closes #189
-rw-r--r-- | README.markdown | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/README.markdown b/README.markdown index bcdbaba0b2..c7346d9efd 100644 --- a/README.markdown +++ b/README.markdown @@ -111,12 +111,10 @@ Suppose we have a table `products` with prices in different currencies. And we h ```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: @@ -139,8 +137,7 @@ comments = Arel::Table.new(:comments) 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: |