Welcome to another edition of This Week in #dev, a series of posts where we bring some of our most interesting Slack conversations to the public.
Overriding Rails Credentials with Environment Variables
Rob Whittaker shares an article that demonstrates how you can override
Rails credentials with environment variables using the Rails 8.2
Rails.app.creds accessor. This can be useful for building a feature
flag system:
features:
dark_mode: false
To enable dark mode, use:
FEATURES__DARK_MODE=1 ./bin/rails server
The Rails image_submit_tag helper
Matheus Richard learned about Rails’ image_submit_tag, a helper
that displays an image which when clicked will submit the form.
image_submit_tag("login.png")
# => <input src="/assets/login.png" type="image" />
Counting Tests with RSpec’s --dry-run Option
Justin Toniazzo shares a tip about using rspec --dry-run to list all
tests without executing them. This can be useful for quickly determining the
number of tests in a codebase:
bin/rspec --dry-run --format json | jq '.examples | length'
Thanks
This edition was brought to you by Justin Toniazzo, Matheus Richard, and Rob Whittaker. Thanks to all contributors! 🎉