See an empty page when access `/rails/mailers` in production

383 Views Asked by At

I am using rails 5 and wanted to see the /rails/mailers url in production mode under the authentication. I am able to implement authentication under the URLs but I can only see a blank page on production(Heroku, review app) but on local I can see the complete page without any issues. I tried production mode on local as well and that was also working fine. Running out of ideas in that direction. Thanks in advance.

2

There are 2 best solutions below

0
On

I got to know, We are not pushing the spec directory to Heroku, hence there is an empty list of the previews and not able to view any preview at all.

0
On

If you use Heroku beware of your .slugignore, you might have 'spec/' in it.

If it is the case, as spec/mailers/previews doesn't exist on heroku instance, you've got a blank page as a result (status 200).

Also note that unlike .gitignore, .slugignore does not support negated ! patterns.

Here is my workaround :
1.move previews away from spec/, to app/mailers/
2.

#environment.rb
...

Rails.application.configure do
  config.action_mailer.preview_path = "#{Rails.root}/app/mailers/previews"
end