aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_mailer_basics.md
diff options
context:
space:
mode:
authorBen Koshy <benkoshy@hotmail.com>2018-02-02 11:25:23 +1100
committerGitHub <noreply@github.com>2018-02-02 11:25:23 +1100
commitbc32fa66ee0ebf1be57adb6adae183e61291eed5 (patch)
treebb7a0ae7fa61df3579fd8c5265a5cdcbd84e4786 /guides/source/action_mailer_basics.md
parent8f2bb58ba2a74975b737f7f7655247b447b7ac08 (diff)
downloadrails-bc32fa66ee0ebf1be57adb6adae183e61291eed5.tar.gz
rails-bc32fa66ee0ebf1be57adb6adae183e61291eed5.tar.bz2
rails-bc32fa66ee0ebf1be57adb6adae183e61291eed5.zip
Update documentation [ci skip]
Remove superfluous repetition and place them in a common section. [ci skip]
Diffstat (limited to 'guides/source/action_mailer_basics.md')
-rw-r--r--guides/source/action_mailer_basics.md27
1 files changed, 15 insertions, 12 deletions
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index fe31e3403f..18ee173a4c 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -20,9 +20,18 @@ Introduction
------------
Action Mailer allows you to send emails from your application using mailer classes
-and views. Mailers work very similarly to controllers. They inherit from
-`ActionMailer::Base` and live in `app/mailers`, and they have associated views
-that appear in `app/views`.
+and views.
+
+#### Mailers are similar to controllers
+They inherit from `ActionMailer::Base` and live in `app/mailers`. Mailers also work very similarly to controllers. Some examples of similarities are enumerated below. Mailers have:
+
+* actions, and also, associated views that appear in `app/views`.
+
+* instance variables that are accessible in views.
+
+* the ability to utilise layouts and partials.
+
+* the ability to access a params hash.
Sending Emails
--------------
@@ -60,8 +69,7 @@ end
```
As you can see, you can generate mailers just like you use other generators with
-Rails. Mailers are conceptually similar to controllers, and so we get a mailer,
-a directory for views, and a test.
+Rails.
If you didn't want to use a generator, you could create your own file inside of
`app/mailers`, just make sure that it inherits from `ActionMailer::Base`:
@@ -73,10 +81,8 @@ end
#### Edit the Mailer
-Mailers are very similar to Rails controllers. They also have methods called
-"actions" and use views to structure the content. Where a controller generates
-content like HTML to send back to the client, a Mailer creates a message to be
-delivered via email.
+Mailers have methods called "actions" and they use views to structure their content. Where a controller generates
+content like HTML to send back to the client, a Mailer creates a message to be delivered via email.
`app/mailers/user_mailer.rb` contains an empty mailer:
@@ -110,9 +116,6 @@ messages in this class. This can be overridden on a per-email basis.
* `mail` - The actual email message, we are passing the `:to` and `:subject`
headers in.
-Just like controllers, any instance variables we define in the method become
-available for use in the views.
-
#### Create a Mailer View
Create a file called `welcome_email.html.erb` in `app/views/user_mailer/`. This