@@ -1,17 +1,31 | |||||
1 |
|
1 | |||
2 | ActiveRecord::Errors.default_error_messages = { |
|
2 | ActiveRecord::Errors.default_error_messages = { | |
3 | :inclusion => "activerecord_error_inclusion", |
|
3 | :inclusion => "activerecord_error_inclusion", | |
4 | :exclusion => "activerecord_error_exclusion", |
|
4 | :exclusion => "activerecord_error_exclusion", | |
5 | :invalid => "activerecord_error_invalid", |
|
5 | :invalid => "activerecord_error_invalid", | |
6 | :confirmation => "activerecord_error_confirmation", |
|
6 | :confirmation => "activerecord_error_confirmation", | |
7 | :accepted => "activerecord_error_accepted", |
|
7 | :accepted => "activerecord_error_accepted", | |
8 | :empty => "activerecord_error_empty", |
|
8 | :empty => "activerecord_error_empty", | |
9 | :blank => "activerecord_error_blank", |
|
9 | :blank => "activerecord_error_blank", | |
10 | :too_long => "activerecord_error_too_long", |
|
10 | :too_long => "activerecord_error_too_long", | |
11 | :too_short => "activerecord_error_too_short", |
|
11 | :too_short => "activerecord_error_too_short", | |
12 | :wrong_length => "activerecord_error_wrong_length", |
|
12 | :wrong_length => "activerecord_error_wrong_length", | |
13 | :taken => "activerecord_error_taken", |
|
13 | :taken => "activerecord_error_taken", | |
14 | :not_a_number => "activerecord_error_not_a_number" |
|
14 | :not_a_number => "activerecord_error_not_a_number" | |
15 | } if ActiveRecord::Errors.respond_to?('default_error_messages=') |
|
15 | } if ActiveRecord::Errors.respond_to?('default_error_messages=') | |
16 |
|
16 | |||
17 | ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" } |
|
17 | ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" } | |
|
18 | ||||
|
19 | # Adds :async_smtp and :async_sendmail delivery methods | |||
|
20 | # to perform email deliveries asynchronously | |||
|
21 | module AsynchronousMailer | |||
|
22 | %w(smtp sendmail).each do |type| | |||
|
23 | define_method("perform_delivery_async_#{type}") do |mail| | |||
|
24 | Thread.start do | |||
|
25 | send "perform_delivery_#{type}", mail | |||
|
26 | end | |||
|
27 | end | |||
|
28 | end | |||
|
29 | end | |||
|
30 | ||||
|
31 | ActionMailer::Base.send :include, AsynchronousMailer |
General Comments 0
You need to be logged in to leave comments.
Login now