Ensure templates like template.html are found but still uses the proper virtual path.
This commit is contained in:
parent
d728f08580
commit
84cab320bc
@ -209,6 +209,12 @@ def teardown
|
||||
assert_equal "New Subject!", email.subject
|
||||
end
|
||||
|
||||
test "translations are scoped properly" do
|
||||
I18n.backend.store_translations('en', :base_mailer => {:email_with_translations => {:greet_user => "Hello %{name}!"}})
|
||||
email = BaseMailer.email_with_translations
|
||||
assert_equal 'Hello lifo!', email.body.encoded
|
||||
end
|
||||
|
||||
# Implicit multipart
|
||||
test "implicit multipart" do
|
||||
email = BaseMailer.implicit_multipart
|
||||
|
1
actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb
vendored
Normal file
1
actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb
vendored
Normal file
@ -0,0 +1 @@
|
||||
<%= t('.greet_user', :name => 'lifo') %>
|
@ -111,4 +111,8 @@ def different_layout(layout_name='')
|
||||
format.html { render :layout => layout_name }
|
||||
end
|
||||
end
|
||||
|
||||
def email_with_translations
|
||||
body render("email_with_translations.html")
|
||||
end
|
||||
end
|
||||
|
@ -113,12 +113,13 @@ def initialize(source, identifier, handler, details)
|
||||
@identifier = identifier
|
||||
@handler = handler
|
||||
@original_encoding = nil
|
||||
|
||||
@virtual_path = details[:virtual_path]
|
||||
@method_names = {}
|
||||
@method_names = {}
|
||||
|
||||
format = details[:format] || :html
|
||||
@formats = Array.wrap(format).map(&:to_sym)
|
||||
|
||||
@virtual_path = details[:virtual_path]
|
||||
@virtual_path.sub!(".#{format}", "") if @virtual_path
|
||||
end
|
||||
|
||||
def render(view, locals, &block)
|
||||
|
Loading…
Reference in New Issue
Block a user