docs: document config/ and some directories in app/.

* Add README files to several directories in app/ giving a brief
  overview of some parts of Danbooru's architecture.
* Add documentation for files in config/.
This commit is contained in:
evazion
2021-06-26 22:47:54 -05:00
parent b9068b8a3e
commit 0563ca3001
28 changed files with 534 additions and 8 deletions

31
app/mailers/README.md Normal file
View File

@@ -0,0 +1,31 @@
# Mailers
This directory contains mailers for sending emails. Mailers are kind of like controllers, except for generating emails
instead of generating HTML.
The actual email templates live in [app/views/user_mailer](../views/user_mailer).
Emails are sent asynchronously using a background job. If sending the email fails, it will be retried later.
Sending emails requires a SMTP server to be configured in
[config/danbooru_local_config.rb](../../config/danbooru_local_config.rb). In production,
[Amazon SES](https://aws.amazon.com/ses/) is used to send emails.
Email templates can be previewed at http://localhost:3000/rails/mailers (assuming you're running `bin/rails server` on
port 3000, the default).
# Example
```ruby
UserMailer.welcome_user(@user).deliver_later
```
# See also
* [app/views/user_mailer](../views/user_mailer)
* [test/mailers/previews/user_mailer_preview.rb](../../test/mailers/previews/user_mailer_preview.rb)
# External links
* https://guides.rubyonrails.org/action_mailer_basics.html
* https://guides.rubyonrails.org/testing.html#testing-your-mailers