Ruby on Rails 8 cheatsheet

Ruby on Rails 8: Maintenance and tools

8 common Ruby on Rails 8 tasks.

Edit encrypted credentials

Open config/credentials.yml.enc in your editor. Set EDITOR first, for example EDITOR="code --wait".

bin/rails credentials:edit

Run code in the app

Run a Ruby snippet with the app loaded.

bin/rails runner "puts User.count"

List TODO comments

Find TODO, FIXME and OPTIMIZE annotations in the code.

bin/rails notes

List the middleware stack

Show the middleware requests pass through.

bin/rails middleware

Check autoloading

Verify that file names match the constants they define.

bin/rails zeitwerk:check

Clear temporary files

Clear cache, sockets and sessions in tmp.

bin/rails tmp:clear

Precompile assets

Build the asset files for production.

bin/rails assets:precompile

Update config for a new Rails version

After upgrading the gem, update configuration files, reviewing each change.

bin/rails app:update

Was this page helpful?