1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/guides
Daniel Colson f976dec24b
Add note to avoid requiring config/initializers
[ci skip]

Closes #40021

I began this commit by adding an additional note about explicitly
requiring initializers. `config/intializers` are loaded with `load`
rather than `require` (and always have been, since they were introduced
way back in c6d6082562). So explicitly requiring them can be problematic
if they are not idempotent.

But @p8 pointed out that it is a bit awkward to have 3 notes and one tip
larger than the actual text in this section.

This commit now also reworks 2 of the notes and the tip into additional
paragraphs in the main text. The benefits of the new version I see:

- We now explicitly say that the initializers are loaded by sort order
- We now start with the ideal way to deal with dependent initializers,
  then follow with a couple warnings. We used to lead with what not to
  do, which I think was a bit confusing.
- The language around subdirectories is much simpler (mentioning that
  subdirectories can be used for organizing seemed unnecessary to me -
  that is true of subdirectories in general, and doesn't have any
  specific connection to initializers)

This commit does not change the opening paragraph or the note about when
to use `after_initialize` instead, although it does reformat them.
2020-08-25 20:25:46 -04:00
..
assets Merge pull request #39406 from vipulnsward/ar-bookstore-model 2020-08-25 17:58:32 -04:00
bug_report_templates Add Action Mailbox bug report templates 2020-07-15 11:04:12 -04:00
rails_guides Fix variable name in guides markdown generator 2020-07-28 10:24:35 +01:00
source Add note to avoid requiring config/initializers 2020-08-25 20:25:46 -04:00
.document
CHANGELOG.md Changes over AR Querying guide [ci skip] 2020-05-27 23:44:24 +05:30
rails_guides.rb Use safe nav operator when calling RailsGuides::Generator.new 2018-12-05 12:41:07 +09:00
Rakefile Remove references to WARNINGS environment variable [ci skip] 2020-07-05 16:40:52 +01:00
w3c_validator.rb Use frozen string literal in guides/ 2017-08-13 22:04:09 +09:00