ActiveSupport::TestCase isn't defined until later in the file, so the
skip override can be added at the end to ensure it exists (similar to
what the Action Pack tests do)
Remove the option `config.public_file_server.enabled` from the generators for all environments, as the value is the same in all environments.
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
Follow-up to #47137.
Since `config.public_file_server.enabled` is true by default, this
commit changes the `config/environments/production.rb` template to
present the setting as an opt-out.
Right now we are using both to test the Rails applications we generate
and to test Rails itself. Let's keep CI for the app and BUILDKITE to
the framework.
It's possible since Rails 6 (3ea2857943dc294d7809930b4cc5b318b9c39577) to let the framework create Event objects, but the guides and docs weren't updated to lead with this example.
Manually instantiating an Event doesn't record CPU time and allocations, I've seen it more than once that people copy-pasting the example code get confused about these stats returning 0. The tests here show that - just like the apps I've worked on - the old pattern keeps getting copy-pasted.
`ActionMailbox::Base#bounce_with` enqueues the bounce email. For
situations where it is preferable to skip the email queues, this
commit introduces `#bounce_now_with`, which sends the bounce email
immediately (like `deliver_now` vs. `deliver_later`).
# Delivers the email immediately
MyMailbox.bounce_now_with MyMailer.my_method(args)
This clarifies that the boolean interpretation (1) is due to YAML rather
than I18n, (2) is case insensitive, and (3) affects both keys and
values.
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
Also add some additional words to make it clear that the modules also
implement handling the exceptions configured with rescue_from, because
it was not immediately clear that happened without reading the code.
Background
----------
During integration tests, it is desirable for the application to respond
as closely as possible to the way it would in production. This improves
confidence that the application behavior acts as it should.
In Rails tests, one major mismatch between the test and production
environments is that exceptions raised during an HTTP request (e.g.
`ActiveRecord::RecordNotFound`) are re-raised within the test rather
than rescued and then converted to a 404 response.
Setting `config.action_dispatch.show_exceptions` to `true` will make the
test environment act like production, however, when an unexpected
internal server error occurs, the test will be left with a opaque 500
response rather than presenting a useful stack trace. This makes
debugging more difficult.
This leaves the developer with choosing between higher quality
integration tests or an improved debugging experience on a failure.
I propose that we can achieve both.
Solution
--------
Change the configuration option `config.action_dispatch.show_exceptions`
from a boolean to one of 3 values: `:all`, `:rescuable`, `:none`. The
values `:all` and `:none` behaves the same as the previous `true` and
`false` respectively. What was previously `true` (now `:all`) continues
to be the default for non-test environments.
The new `:rescuable` value is the new default for the test environment.
It will show exceptions in the response only for rescuable exceptions as
defined by `ActionDispatch::ExceptionWrapper.rescue_responses`. In the
event of an unexpected internal server error, the exception that caused
the error will still be raised within the test so as to provide a useful
stack trace and a good debugging experience.
Currently when opening the main framework pages there is no introduction
to the framework. Instead we only see a whole lot of modules and the
`gem_version` and `version` methods.
By including the READMEs using the `:include:` directive each frameworks
has a nice introduction.
For markdown READMEs we need to add the :markup: directive.
[ci-skip]
Co-authored-by: zzak <zzakscott@gmail.com>
* Remove Copyright years
* Basecamp is now 37signals... again
Co-authored-by: David Heinemeier Hansson <dhh@hey.com>
---------
Co-authored-by: David Heinemeier Hansson <dhh@hey.com>
Generated using the following script and manually reviewed after:
skipkayhil/rails-bin@6898611730
The :messages route was removed because there isn't actually a
MessagesController.
config/boot.rb also has its Gemfile path fixed to point at the root
Gemfile because Action Mailbox does not have a Gemfile.
All the common rails commands and some extended commands use the
infinitive form for the verb in the description. This changes the
remaining tasks to use the infinitive form verb as well, for
consistency.
__Before__
```console
$ bin/rails --help
...
action_mailbox:install Installs Action Mailbox and its dependencies
...
app:template Applies the template supplied by LOCATION=(/path/to/template) or URL
...
credentials:diff Enrolls/disenrolls in decrypted diffs of credentials using git
credentials:edit Opens the decrypted credentials in `$EDITOR` for editing
credentials:show Shows the decrypted credentials
db:create Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use...
db:drop Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use d...
...
db:fixtures:load Loads fixtures into the current environment's database
db:migrate Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
db:migrate:down Runs the "down" for a given migration VERSION
db:migrate:redo Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)
db:migrate:up Runs the "up" for a given migration VERSION
db:prepare Runs setup if database does not exist, or runs migrations if it does
db:reset Drops and recreates all databases from their schema for the current environment and loads th...
db:rollback Rolls the schema back to the previous version (specify steps w/ STEP=n)
db:schema:cache:clear Clears a db/schema_cache.yml file
db:schema:cache:dump Creates a db/schema_cache.yml file
db:schema:dump Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['...
db:schema:load Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SC...
db:seed Loads the seed data from db/seeds.rb
db:seed:replant Truncates tables of each database for current environment and loads the seeds
db:setup Creates all databases, loads all schemas, and initializes with the seed data (use db:reset t...
db:system:change Changes `config/database.yml` and your database gem to the target database
db:version Retrieves the current schema version number
destroy Removes code generated by `bin/rails generate`
dev:cache Toggles development mode caching on/off
encrypted:edit Opens the decrypted file in `$EDITOR` for editing
encrypted:show Shows the decrypted contents of the file
...
log:clear Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test...
middleware Prints out your Rack middleware stack
notes Shows comments in your code annotated with FIXME, OPTIMIZE, and TODO
...
routes Lists all the defined routes
runner Runs Ruby code in the context of your application
...
secrets:edit Opens the secrets in `$EDITOR` for editing
secrets:show Shows the decrypted secrets
...
tmp:create Creates tmp directories for cache, sockets, and pids
version Shows the Rails version
...
zeitwerk:check Checks project structure for Zeitwerk compatibility
```
__After__
```console
$ bin/rails --help
...
action_mailbox:install Install Action Mailbox and its dependencies
...
app:template Apply the template supplied by LOCATION=(/path/to/template) or URL
...
credentials:diff Enrolls/disenrolls in decrypted diffs of credentials using git
credentials:edit Opens the decrypted credentials in `$EDITOR` for editing
credentials:show Shows the decrypted credentials
db:create Create the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use ...
db:drop Drop the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db...
...
db:fixtures:load Load fixtures into the current environment's database
db:migrate Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
db:migrate:down Run the "down" for a given migration VERSION
db:migrate:redo Roll back the database one migration and re-migrate up (options: STEP=x, VERSION=x)
db:migrate:status Display status of migrations
db:migrate:up Run the "up" for a given migration VERSION
db:prepare Run setup if database does not exist, or run migrations if it does
db:reset Drop and recreate all databases from their schema for the current environment and load the s...
db:rollback Roll the schema back to the previous version (specify steps w/ STEP=n)
db:schema:cache:clear Clear a db/schema_cache.yml file
db:schema:cache:dump Create a db/schema_cache.yml file
db:schema:dump Create a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['S...
db:schema:load Load a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCH...
db:seed Load the seed data from db/seeds.rb
db:seed:replant Truncate tables of each database for current environment and load the seeds
db:setup Create all databases, load all schemas, and initialize with the seed data (use db:reset to a...
db:system:change Change `config/database.yml` and your database gem to the target database
db:version Retrieve the current schema version number
destroy Remove code generated by `bin/rails generate`
dev:cache Toggle development mode caching on/off
encrypted:edit Open the decrypted file in `$EDITOR` for editing
encrypted:show Show the decrypted contents of the file
...
log:clear Truncate all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test...
middleware Print out your Rack middleware stack
notes Show comments in your code annotated with FIXME, OPTIMIZE, and TODO
...
routes List all the defined routes
runner Run Ruby code in the context of your application
...
secrets:edit Open the secrets in `$EDITOR` for editing
secrets:show Show the decrypted secrets
...
tmp:create Create tmp directories for cache, sockets, and pids
version Show the Rails version
...
zeitwerk:check Check project structure for Zeitwerk compatibility
```
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
* Logging to a file doesn't make sense in production
You're going to run out of space, and it doesn't play well with containers. Either you log to STDOUT, and let your container setup aggregate the logs, or you'll be switching to syslogger or whatever. You won't be logging to a file in production any more.
* Remove from Dockerfile too
* Did not mean to change this default
But we should make it easy to see how to change it.
* Restore what we had