Jon here welcoming you to This Week in Rails!
Today weāll be touring the wondrous Ruby on Rails chocolate factory to see how its marvelous candy, consumed by web apps and developers everywhere, is made and tested.
Golden tickets in hand? Letās go!
This week, 26 fabulous oompa-loompas concocted improvements to make your favorite candy even more delicious ā including one for the first time!
If you upgrade to bundler 1.13 and use github options to specify gem sources in your Gemfile, youāll see warnings when running bundle commands.
To fix, you can run bundle config github.https true on the command line.
Or if you donāt control the environment the Gemfile will execute in, you can add this to the Gemfile, like Rails now does:
git_source(:github) |repo_name| do
Ā āhttps://github.com/#{ārepo_name}ā.gitā
end
Backported to 5-0-stable.
This pull request added documentation for config/puma.rb to recommend closing database connections if preloading an application that uses Active Record. See the discussions in the pull request and in puma/puma#1001 for more.
To improve productivity when writing tests, if an assert_response test fails, Rails nows outputs the actual response body if itās not too large (less than or equal to 500 chars).
Following-up on a very good bug report, this PR fixed a Rails 5 regression so that calling ActiveRecord#touch when using optimistic locking once again leaves the model in a non-dirty state with no attribute changes.
Tests using ActionDispatch::IntegrationTest were failing when run after any controller test that modified request.session_options. It turned out thatĀ ActionController::TestSession::DEFAULT_OPTIONS was being mutated, and as a result, Rack::Session::Abstract::Persisted::DEFAULT_OPTIONS also, which made integration tests inherit that value and fail.
This pull request dupāed the AC default options constant to prevent mutation, and a pull request to Rack was merged to freeze the Rack default options constant and avoid the issue in the future.
This pull request fixed issue #26441: āNameError: uninitialized constant AR::ConnectionAdapters::DatabaseStatements::TransactionManager when calling reset_transactionā.
Running the Rails test suite can be a great way to uncover minor issues to fix. This pull request addressed 2 warnings in the test suite that arose simply from not wrapping a method argument in parentheses.
Noticing that there were no tests for when ActiveRecord::Enum#enum was called with a specific suffix, this contributor added some.
Better documentation is always welcome. After seeing issue #26286, this contributor helpfully improved the documentation for the render partial āasā option.
The commit message says it all: āI created this for testing migrations in isolation and thought it would be helpful to others in the future to avoid having to dig through the Rails migration tests.ā
This elsif branch was a duplicate of the else branch just after it. Youāll never believe what happened next š®.
Thatās it for todayās tour, but the true journey has only just begun.
Starting today, choose any file in the Rails codebase and read it.
Pick an open issue on the master branch, and try to reproduce the bug using the Rails bug report templates.
Go through the Contributing to Ruby on Rails Guide. Set up your Rails test environment.
Pick an open pull request and test it or review it.
Youāll be surprised what baby steps like these can lead to!
Enjoy the wonderful chocolate ā and see you next week.