Skip to content
Browse files

Merge pull request #264 from peternixey/master

I've added a couple of lines into the Readme to explain how to select multiple attributes
  • Loading branch information...
2 parents 23281d5 + 61541ff commit 20eb0fa8826e2c0992ab3c3b3b59256ddd78dbbf @ernie ernie committed Aug 1, 2013
Showing with 12 additions and 0 deletions.
  1. +12 −0 README.md
View
12 README.md
@@ -467,6 +467,18 @@ p.flanderized_name
As you can see, just like functions, these operations can be given aliases.
+To select more than one attribute (or calculated attribute) simply put them into an array:
+
+```ruby
+p = Person.select{[ name.op('||', '-diddly').as(flanderized_name),
+ coalesce(name, '<no name given>').as(name_with_default) ]}.first
+p.flanderized_name
+# => "Aric Smith-diddly"
+p.name_with_default
+# => "Aric Smith"
+```
+
+
## Compatibility with Active Record
Most of the new functionality provided by Squeel is accessed with the new block-style `where{}`

0 comments on commit 20eb0fa

Please sign in to comment.
Something went wrong with that request. Please try again.