Skip to content
Browse files

[ci skip] Doc ability to chain in `find_each`

Also use appropriate mailer syntax in the `find_each` block.
  • Loading branch information...
1 parent 63f4155 commit f7e4362011ceb1317fd401125d48d7ccb9a1079c @schneems schneems committed Jun 28, 2014
Showing with 9 additions and 1 deletion.
  1. +9 −1 guides/source/active_record_querying.md
View
10 guides/source/active_record_querying.md
@@ -309,7 +309,15 @@ The `find_each` method retrieves a batch of records and then yields _each_ recor
```ruby
User.find_each do |user|
- NewsLetter.weekly_deliver(user)
+ NewsMailer.weekly(user).deliver
+end
+```
+
+To add conditions to a `find_each` operation you can chain other Active Record methods such as `where`:
+
+```ruby
+User.where(weekly_subscriber: true).find_each do |user|
+ NewsMailer.weekly(user).deliver
end
```

0 comments on commit f7e4362

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