This PR fixes an issue I ran into, where generating a mailer did not work correctly. Here's what the issue looks like:
λ bin/rails generate mailer UserMailer
Running via Spring preloader in process 14169
create app/mailers/user_mailer.rb
invoke haml
create app/views/user_mailer_mailer <-- This doesn't match!
invoke test_unit
create test/mailers/user_mailer_test.rb
create test/mailers/previews/user_mailer_preview.rb
The views directory (and any actions created inside it) have the duplicated _mailer_mailer suffix, and the mailer will error and not be able to find the views because the names do not match. The ERB generator, like all other Rails generators, strips these suffixes, but haml-rails does not, which is why there is a discrepancy.
This PR adds a test to make sure duplicate suffixes are handled, and fixes the issue (and simplifies the code) by inheriting from the ERB mailer generator.
First of all, thanks for
haml-rails
!This PR fixes an issue I ran into, where generating a mailer did not work correctly. Here's what the issue looks like:
The views directory (and any actions created inside it) have the duplicated
_mailer_mailer
suffix, and the mailer will error and not be able to find the views because the names do not match. The ERB generator, like all other Rails generators, strips these suffixes, buthaml-rails
does not, which is why there is a discrepancy.This PR adds a test to make sure duplicate suffixes are handled, and fixes the issue (and simplifies the code) by inheriting from the ERB mailer generator.