Skip to content

Commit 4ec7493

Browse files
author
Francesco Rodriguez
committed
use _action callbacks in actionmailer
1 parent bef3308 commit 4ec7493

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

actionmailer/lib/action_mailer/base.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ module ActionMailer
284284
#
285285
# = Callbacks
286286
#
287-
# You can specify callbacks using before_filter and after_filter for configuring your messages.
287+
# You can specify callbacks using before_action and after_action for configuring your messages.
288288
# This may be useful, for example, when you want to add default inline attachments for all
289289
# messages sent out by a certain mailer class:
290290
#
291291
# class Notifier < ActionMailer::Base
292-
# before_filter :add_inline_attachment!
292+
# before_action :add_inline_attachment!
293293
#
294294
# def welcome
295295
# mail
@@ -306,8 +306,8 @@ module ActionMailer
306306
# can define and configure callbacks in the same manner that you would use callbacks in
307307
# classes that inherit from ActionController::Base.
308308
#
309-
# Note that unless you have a specific reason to do so, you should prefer using before_filter
310-
# rather than after_filter in your ActionMailer classes so that headers are parsed properly.
309+
# Note that unless you have a specific reason to do so, you should prefer using before_action
310+
# rather than after_action in your ActionMailer classes so that headers are parsed properly.
311311
#
312312
# = Configuration options
313313
#

actionmailer/test/base_test.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,9 @@ def self.delivering_email(mail)
584584
assert_equal("Thanks for signing up this afternoon", mail.subject)
585585
end
586586

587-
test "modifying the mail message with a before_filter" do
588-
class BeforeFilterMailer < ActionMailer::Base
589-
before_filter :add_special_header!
587+
test "modifying the mail message with a before_action" do
588+
class BeforeActionMailer < ActionMailer::Base
589+
before_action :add_special_header!
590590

591591
def welcome ; mail ; end
592592

@@ -596,12 +596,12 @@ def add_special_header!
596596
end
597597
end
598598

599-
assert_equal('Wow, so special', BeforeFilterMailer.welcome['X-Special-Header'].to_s)
599+
assert_equal('Wow, so special', BeforeActionMailer.welcome['X-Special-Header'].to_s)
600600
end
601601

602-
test "modifying the mail message with an after_filter" do
603-
class AfterFilterMailer < ActionMailer::Base
604-
after_filter :add_special_header!
602+
test "modifying the mail message with an after_action" do
603+
class AfterActionMailer < ActionMailer::Base
604+
after_action :add_special_header!
605605

606606
def welcome ; mail ; end
607607

@@ -611,12 +611,12 @@ def add_special_header!
611611
end
612612
end
613613

614-
assert_equal('Testing', AfterFilterMailer.welcome['X-Special-Header'].to_s)
614+
assert_equal('Testing', AfterActionMailer.welcome['X-Special-Header'].to_s)
615615
end
616616

617-
test "adding an inline attachment using a before_filter" do
617+
test "adding an inline attachment using a before_action" do
618618
class DefaultInlineAttachmentMailer < ActionMailer::Base
619-
before_filter :add_inline_attachment!
619+
before_action :add_inline_attachment!
620620

621621
def welcome ; mail ; end
622622

actionpack/test/controller/default_url_options_with_filter_test.rb renamed to actionpack/test/controller/default_url_options_with_before_action_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
require 'abstract_unit'
22

33

4-
class ControllerWithBeforeFilterAndDefaultUrlOptions < ActionController::Base
4+
class ControllerWithBeforeActionAndDefaultUrlOptions < ActionController::Base
55

6-
before_filter { I18n.locale = params[:locale] }
7-
after_filter { I18n.locale = "en" }
6+
before_action { I18n.locale = params[:locale] }
7+
after_action { I18n.locale = "en" }
88

99
def target
1010
render :text => "final response"
@@ -19,11 +19,11 @@ def default_url_options
1919
end
2020
end
2121

22-
class ControllerWithBeforeFilterAndDefaultUrlOptionsTest < ActionController::TestCase
22+
class ControllerWithBeforeActionAndDefaultUrlOptionsTest < ActionController::TestCase
2323

2424
# This test has its roots in issue #1872
2525
test "should redirect with correct locale :de" do
2626
get :redirect, :locale => "de"
27-
assert_redirected_to "/controller_with_before_filter_and_default_url_options/target?locale=de"
27+
assert_redirected_to "/controller_with_before_action_and_default_url_options/target?locale=de"
2828
end
2929
end

0 commit comments

Comments
 (0)