class Rails::MailersController
def find_preview # :doc:
def find_preview # :doc: candidates = [] params[:path].to_s.scan(%r{/|$}) { candidates << $` } preview = candidates.detect { |candidate| ActionMailer::Preview.exists?(candidate) } if preview @preview = ActionMailer::Preview.find(preview) else raise AbstractController::ActionNotFound, "Mailer preview '#{params[:path]}' not found" end end