aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-11-14 13:59:00 -0500
committerGitHub <noreply@github.com>2017-11-14 13:59:00 -0500
commitb9675aa72252671c167721b597071e5751b1d409 (patch)
treef32ea1725a0a3d82afd79c0ec9bc76962e2e0b32
parentb0ad8046091ce45a20fc7a5cb68b4599f876bbbb (diff)
parent27a7af81bd274f8036f42638acdb47e85e76c5aa (diff)
downloadrails-b9675aa72252671c167721b597071e5751b1d409.tar.gz
rails-b9675aa72252671c167721b597071e5751b1d409.tar.bz2
rails-b9675aa72252671c167721b597071e5751b1d409.zip
Merge pull request #501 from abelards/patch-1
Better titles
-rw-r--r--README.md5
1 files changed, 4 insertions, 1 deletions
diff --git a/README.md b/README.md
index af768361ab..065bfea26c 100644
--- a/README.md
+++ b/README.md
@@ -188,7 +188,7 @@ users.project(users[:age].average.as("mean_age"))
# => SELECT AVG(users.age) AS mean_age FROM users
```
-### The Crazy Features
+### The Advanced Features
The examples above are fairly simple and other libraries match or come close to matching the expressiveness of Arel (e.g. `Sequel` in Ruby).
@@ -215,6 +215,7 @@ products.
#### Complex Joins
+##### Alias
Where Arel really shines is in its ability to handle complex joins and aggregations. As a first example, let's consider an "adjacency list", a tree represented in a table. Suppose we have a table `comments`, representing a threaded discussion:
```ruby
@@ -240,6 +241,7 @@ comments_with_replies = \
This will return the reply for the first comment.
+##### CTE
[Common Table Expressions (CTE)](https://en.wikipedia.org/wiki/Common_table_expressions#Common_table_expression) support via:
Create a `CTE`
@@ -262,6 +264,7 @@ users.
# FROM users INNER JOIN cte_table ON users.id = cte_table.user_id
```
+#### Write SQL strings
When your query is too complex for `Arel`, you can use `Arel::SqlLiteral`:
```ruby