about summary refs log tree commit diff stats
path: root/test/mailers/previews/vote_mailer_preview.rb
blob: dfc5da1cedfdb01409306e25fe2cfa61a1e71d90 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
# Preview all emails at http://localhost:3000/rails/mailers/vote_mailer
class VoteMailerPreview < ActionMailer::Preview

  # Preview this email at http://localhost:3000/rails/mailers/vote_mailer/daily_report_email
  def daily_report_email
    # Duplicating logic from the task... love it
    votes = Vote.where("created_at > ?", 1.day.ago).where(upvote: 1).all
    VoteMailer.with(votes: votes).daily_report_email
  end

end