Sha256: 92065f85243897711489a3df1d294a1326c566c0c103b589ba150e66341d5213
Contents?: true
Size: 772 Bytes
Versions: 13
Compression:
Stored size: 772 Bytes
Contents
module MailForm class Notifier < ActionMailer::Base self.mailer_name = "mail_form" append_view_path File.expand_path('../views', __FILE__) def contact(resource) if resource.request.nil? && resource.class.mail_appendable.any? raise ScriptError, "You set :append values but forgot to give me the request object" end @resource = @form = resource resource.class.mail_attachments.each do |attribute| value = resource.send(attribute) next unless value.respond_to?(:read) attachments[value.original_filename] = value.read end headers = resource.headers headers[:from] ||= resource.email headers[:subject] ||= resource.class.model_name.human mail(headers) end end end
Version data entries
13 entries across 13 versions & 1 rubygems