mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Ensure templates like template.html are found but still uses the proper virtual path.
This commit is contained in:
@@ -209,6 +209,12 @@ class BaseTest < ActiveSupport::TestCase
|
||||
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 @@ class BaseMailer < ActionMailer::Base
|
||||
format.html { render :layout => layout_name }
|
||||
end
|
||||
end
|
||||
|
||||
def email_with_translations
|
||||
body render("email_with_translations.html")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,12 +113,13 @@ module ActionView
|
||||
@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)
|
||||
|
||||
Reference in New Issue
Block a user