6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/mail_form/notifier.rb', line 6
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
= resource.
[:from] ||= resource.email
[:subject] ||= resource.class.model_name.human
mail()
end
|