saasbook

dip_example_2.rb

Mar 13th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.39 KB | None | 0 0
  1. class EmailList
  2.   attr_reader :mailer
  3.   delegate :send_email, :to => :mailer
  4.   def initialize(mailer_type)
  5.     @mailer = mailer_type.new
  6.   end
  7. end
  8. # in RottenPotatoes EmailListController:
  9. def advertise_discount_for_movie
  10.   moviegoers = Moviegoer.interested_in params[:movie_id]
  11.   mailer = if Config.has_amiko? then Amiko else MailerMonkey end
  12.   EmailList.new(mailer).send_email_to moviegoers
  13. end
Add Comment
Please, Sign In to add comment