Rails 4.1 introduced the ability to preview email messages from your mailers without sending an email. Learn how ...
As of Rails 4.1, you can now preview emails while developing (without sending an email). Let's say you have a mailer that looks like this:
class NotificationMailer < ActionMailer::Base
@user = user
mail :to => user.email, :from => 'firstname.lastname@example.org',
:subject => 'Welcome!'
To preview it, create a file in
test/previews and call the mailer method just as you would from any model or controller in your app.
class NotificationPreview < ActionMailer::Preview
Then you can preview the email at [/rails/mailers/notification/welcome](http:// rails/mailers/notification/welcome).
Notice the preview route matches the preview class name and then preview method, which doesn't necessarily need to be related to the mailer itself.
Also note the preview filename is appended with
It's annoying to shut down and start up your Rails server when jumping between projects. Learn how to run multiple servers at the same time.
Transitioning from one database to another, or even to a whole new database with a new adapter, can be tough. Here's an easy way to transition content.
Converting a PDF to an image using Rails and Dragonfly is actually quite simple. Check it out.