Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 917b6c957b
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (23 sloc) 0.587 kB
#--
# Copyright (C) 2009 Dimitrij Denissenko
# Please read LICENSE document for more information.
#++
class QueuedMail < ActiveRecord::Base
serialize :object
validates_presence_of :object, :mailer_class_name
named_scope :pending, :conditions => ['delivered_at IS NULL'], :order => 'created_at'
def mailer_class
mailer_class_name.constantize rescue nil
end
def deliver!
if mailer_class
mailer_class.deliver(object)
deactivate!
else
false
end
end
def deactivate!
update_attribute :delivered_at, Time.now.utc
end
end
Jump to Line
Something went wrong with that request. Please try again.