See #892 for a detailed proposal of these changes. I will be opening several PRs to achieve the final state so there is a more readable history of the changes.
Part 4 addresses the following:
Renames Transfer to Account::Transfer
Standardizes some of our namespacing (read section below)
Namespacing convention
Previously, we had all of our namespaces in the plural form, which presented a few challenges with automatic path and partial resolutions and forced us to maintain a slightly hard-to-read routes file.
To explain the issue, we can look at Account::Transfer as an example:
By default, Rails does not automatically "pluralize" the namespaced prefix, Account::. With our prior setup, we had the Transfer partial sitting at /accounts/transfers/_transfer.html.erb.
This made it so the following line would never resolve by "convention":
<%= render @transfer %>
In an effort to make this codebase as predictable as possible for new contributors, I've updated all of these namespaces to match the singular form and use the following convention (using the namespaced Account::Transfer model as example):
Routes
namespace :account do
resources :transfers, only: %i[ new create destroy ]
end
resources :accounts do
# other routes
# Namespaced, nested resource
resource :logo, only: :show, module: :account
end
See #892 for a detailed proposal of these changes. I will be opening several PRs to achieve the final state so there is a more readable history of the changes.
Part 4 addresses the following:
Namespacing convention
Previously, we had all of our namespaces in the plural form, which presented a few challenges with automatic path and partial resolutions and forced us to maintain a slightly hard-to-read routes file.
To explain the issue, we can look at
Account::Transfer
as an example:By default, Rails does not automatically "pluralize" the namespaced prefix,
Account::
. With our prior setup, we had the Transfer partial sitting at/accounts/transfers/_transfer.html.erb
.This made it so the following line would never resolve by "convention":
In an effort to make this codebase as predictable as possible for new contributors, I've updated all of these namespaces to match the singular form and use the following convention (using the namespaced
Account::Transfer
model as example):Routes
Controllers, Views, Locales
AccountsController
Account::TransfersController
Account
Account::Transfer