Add _mailer suffix to generated file names. - #18074
Conversation
|
Given that we're changing the existing behaviour, perhaps we could detect and silently ignore any trailing So, would both generate the same thing? If we're asserting that FooMailer is the "normal" choice of name, then presumably people are currently more likely to run the latter of those commands. |
|
Excellent point! I'll work on that next. |
|
Please let me know if there's a better way to prevent duplicate suffixes like I'm doing here. I feel like there should be.. |
|
The implementation looks good to me. @dhh what do you think about the convention change? |
|
👍 |
|
Great! @caike mind to add a CHANGELOG entry and squash your commits? |
There was a problem hiding this comment.
Can we use sub here?
@_file_name ||= super.sub(/\_mailer\.rb$/i, '')There was a problem hiding this comment.
I've tried your suggestion @JuanitoFatas , but looks like using sub this way doesn't account for removing duplicates. See the failure on MailerGeneratorTest#test_mailer_suffix_is_not_duplicated at https://travis-ci.org/rails/rails/jobs/46081505
Following the same naming convention used in controllers and jobs.
Add _mailer suffix to generated file names.
|
❤️ 💚 💙 💛 💜 |
|
💚💛❤️💙💜 |
There was a problem hiding this comment.
Shouldn't the i18n path for the subject change as well?
There was a problem hiding this comment.
Good catch! 👍
New PR submitted
|
Thanks for catching those @y-yagi ! 👍 |
In Rails 5, was forced as `_mailer` suffix is set. Ref: rails/rails#18074
In Rails 5, was forced as `_mailer` suffix is set. Ref: rails/rails#18074
In Rails 5, was forced as `_mailer` suffix is set. Ref: rails/rails#18074
It is somewhat confusing that controllers and jobs follow this convention, but mailers don't.