Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update README.

  • Loading branch information...
commit 89ba919caefb457eb819b11ee7c9ccd099345f8b 1 parent 3ab072f
@josevalim josevalim authored
Showing with 6 additions and 9 deletions.
  1. +1 −5 README.rdoc
  2. +2 −1  lib/mail_form.rb
  3. +3 −3 test/mail_form_test.rb
View
6 README.rdoc
@@ -168,9 +168,7 @@ request object responds to.
== I18n
I18n in MailForm works like in ActiveRecord, so all models, attributes and messages
-can be used with localized. However, in order to DRY up your yml files, mail_form
-requires on I18n >= 0.2.0 since it uses the ability to symlink translations. Below
-is an I18n example file:
+can be used with localized. Below is an I18n file example file:
mail_form:
models:
@@ -180,8 +178,6 @@ is an I18n example file:
email: "E-mail"
telephone: "Telephone number"
message: "Sent message"
- errors:
- messages: :"activerecord.errors.messages"
request:
title: "Technical information about the user"
remote_ip: "IP Address"
View
3  lib/mail_form.rb
@@ -20,7 +20,8 @@ def contact(resource)
end
headers = resource.headers
- headers[:from] ||= resource.email
+ headers[:from] ||= resource.email
+ headers[:subject] ||= resource.class.human_name
mail(headers)
end
end
View
6 test/mail_form_test.rb
@@ -21,14 +21,14 @@ def test_email_is_sent
assert_equal 1, ActionMailer::Base.deliveries.size
end
- def test_subject_defaults_to_action_mailer_one
+ def test_subject_defaults_to_human_class_name
@form.deliver
- assert_equal 'Contact', first_delivery.subject
+ assert_equal 'Contact form', first_delivery.subject
end
def test_body_contains_subject
@form.deliver
- assert_match /Contact/, first_delivery.body.to_s
+ assert_match /Contact form/, first_delivery.body.to_s
end
def test_body_contains_attributes_values

0 comments on commit 89ba919

Please sign in to comment.
Something went wrong with that request. Please try again.