Skip to content

Commit 1b0d267

Browse files
committed
Regular maintenance.
1 parent 26f98e3 commit 1b0d267

File tree

4 files changed

+25
-29
lines changed

4 files changed

+25
-29
lines changed

source/action_mailer_basics.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,22 @@ globally in `config/application.rb`:
414414
config.action_mailer.default_url_options = { host: 'example.com' }
415415
```
416416

417+
Because of this behavior you cannot use any of the `*_path` helpers inside of
418+
an email. Instead you will need to use the associated `*_url` helper. For example
419+
instead of using
420+
421+
```
422+
<%= link_to 'welcome', welcome_path %>
423+
```
424+
425+
You will need to use:
426+
427+
```
428+
<%= link_to 'welcome', welcome_url %>
429+
```
430+
431+
By using the full URL, your links will now work in your emails.
432+
417433
#### generating URLs with `url_for`
418434
419435
You need to pass the `only_path: false` option when using `url_for`. This will

source/active_record_querying.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -267,23 +267,6 @@ This is equivalent to writing:
267267
Client.where(first_name: 'does not exist').take!
268268
```
269269

270-
#### `last!`
271-
272-
`Model.last!` finds the last record ordered by the primary key. For example:
273-
274-
```ruby
275-
client = Client.last!
276-
# => #<Client id: 221, first_name: "Russel">
277-
```
278-
279-
The SQL equivalent of the above is:
280-
281-
```sql
282-
SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1
283-
```
284-
285-
`Model.last!` raises `ActiveRecord::RecordNotFound` if no matching record is found.
286-
287270
### Retrieving Multiple Objects in Batches
288271

289272
We often need to iterate over a large set of records, as when we send a newsletter to a large set of users, or when we export data.
@@ -293,7 +276,7 @@ This may appear straightforward:
293276
```ruby
294277
# This is very inefficient when the users table has thousands of rows.
295278
User.all.each do |user|
296-
NewsLetter.weekly_deliver(user)
279+
NewsMailer.weekly(user).deliver
297280
end
298281
```
299282

@@ -333,7 +316,7 @@ The `:batch_size` option allows you to specify the number of records to be retri
333316

334317
```ruby
335318
User.find_each(batch_size: 5000) do |user|
336-
NewsLetter.weekly_deliver(user)
319+
NewsMailer.weekly(user).deliver
337320
end
338321
```
339322

@@ -345,7 +328,7 @@ For example, to send newsletters only to users with the primary key starting fro
345328

346329
```ruby
347330
User.find_each(start: 2000, batch_size: 5000) do |user|
348-
NewsLetter.weekly_deliver(user)
331+
NewsMailer.weekly(user).deliver
349332
end
350333
```
351334

source/getting_started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ And then finally, add the view for this action, located at
909909
</table>
910910
```
911911

912-
Now if you go to `http://localhost:3000/articles` you will see a list of all the
912+
Now if you go to <http://localhost:3000/articles> you will see a list of all the
913913
articles that you have created.
914914

915915
### Adding links
@@ -1105,7 +1105,7 @@ standout.
11051105

11061106
Now you'll get a nice error message when saving an article without title when
11071107
you attempt to do just that on the new article form
1108-
[(http://localhost:3000/articles/new)](http://localhost:3000/articles/new).
1108+
<http://localhost:3000/articles/new>:
11091109

11101110
![Form With Errors](images/getting_started/form_with_errors.png)
11111111

source/testing.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,8 @@ Ideally, you would like to include a test for everything which could possibly br
364364

365365
By now you've caught a glimpse of some of the assertions that are available. Assertions are the worker bees of testing. They are the ones that actually perform the checks to ensure that things are going as planned.
366366

367-
There are a bunch of different types of assertions you can use. Here's an
368-
extract of the
369-
[assertions](http://docs.seattlerb.org/minitest/Minitest/Assertions.html) you
370-
can use with [minitest](https://github.com/seattlerb/minitest), the default
371-
testing library used by Rails. The `[msg]` parameter is an optional string
372-
message you can specify to make your test failure messages clearer. It's not
373-
required.
367+
There are a bunch of different types of assertions you can use.
368+
Here's an extract of the assertions you can use with [`Minitest`](https://github.com/seattlerb/minitest), the default testing library used by Rails. The `[msg]` parameter is an optional string message you can specify to make your test failure messages clearer. It's not required.
374369

375370
| Assertion | Purpose |
376371
| ---------------------------------------------------------------- | ------- |
@@ -406,6 +401,8 @@ required.
406401
| `assert_send( array, [msg] )` | Ensures that executing the method listed in `array[1]` on the object in `array[0]` with the parameters of `array[2 and up]` is true. This one is weird eh?|
407402
| `flunk( [msg] )` | Ensures failure. This is useful to explicitly mark a test that isn't finished yet.|
408403

404+
The above are subset of assertions that minitest supports. For an exhaustive & more up-to-date list, please check [Minitest API documentation](http://docs.seattlerb.org/minitest/), specifically [`Minitest::Assertions`](http://docs.seattlerb.org/minitest/Minitest/Assertions.html)
405+
409406
Because of the modular nature of the testing framework, it is possible to create your own assertions. In fact, that's exactly what Rails does. It includes some specialized assertions to make your life easier.
410407

411408
NOTE: Creating your own assertions is an advanced topic that we won't cover in this tutorial.

0 commit comments

Comments
 (0)