This project is archived and is in readonly mode.
ActionView::Template doesn't support multipart formats with locale
Reported by Mateusz Drożdżyński | March 18th, 2009 @ 10:43 AM | in 2.x
ActionView::Template seems to parse templates with multipart format and locale incorrectly. That is if you have a file template.en.text.plain.erb it falls back to thinking 'en' is the format.
Here's how it parses a simple template:
#<ActionView::ReloadableTemplate:0x3b84194 @previously_last_modified=Tue Mar 17 12:33:25 +0100 2009, @_memoized_method_segment=["app47views47mailer47activation46en46text46plain46erb"], @format="en", @_memoized_relative_path=["app/views/mailer/activation.en.text.plain.erb"], @extension=nil, @_memoized_method_name_without_locals=["_run_app47views47mailer47activation46en46text46plain46erb"], @load_path="/Users/matid/Projects/***/trunk/app/views", @base_path="mailer", @filename="/Users/matid/Projects/***/trunk/app/views/mailer/activation.en.text.plain.erb", @locale=nil, @name="activation", @template_path="mailer/activation.en.text.plain.erb">
I attach the patch to fix this behaviour. I couldn't figure out where the tests for ActionView::Template are located thus lack of thereof.
Comments and changes to this ticket
-
Eloy Duran March 18th, 2009 @ 12:57 PM
- Assigned user set to josh
I couldn't figure out where the tests for ActionView::Template are located thus lack of thereof.
You are right, there are none yet. Please add a failing unit test which tests the #split method.
I can imagine something like the following (untested code):
test "filename parsing" do ["template.en.text.plain.erb", :name => 'template', :extension => 'erb', :format => 'text', :locale => 'en'].each do |file, expected| template = ActionView::Template.new(file) expected.each do |name, value| assert_equal value, template.send(name) end end end
-
Mateusz Drożdżyński March 19th, 2009 @ 07:08 PM
I'd be glad to add a test to cover my patch yet I still can't find any reasonable file to put it in. Any suggestions? I couldn't find any other tests that would test the #split method.
-
thedarkone March 24th, 2009 @ 12:31 AM
I rewrote extension parsing in #2315. Mateusz, your issue should be automaticaly fixed as well.
-
Repository March 24th, 2009 @ 03:54 PM
- State changed from new to resolved
(from [6a1267a0b12560a752ebfb443194de1a0ab3bef5]) Fix template extension parsing. [#2315 state:resolved] [#2284 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
Repository March 24th, 2009 @ 03:54 PM
(from [ae9f258e03c9fd5088da12c1c6cd216cc89a01f7]) Fix template extension parsing. [#2315 state:resolved] [#2284 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2315 ActionView::Template extension processing bug This should also close #2284.
- 2315 ActionView::Template extension processing bug (from [6a1267a0b12560a752ebfb443194de1a0ab3bef5]) Fix tem...
- 2284 ActionView::Template doesn't support multipart formats with locale (from [6a1267a0b12560a752ebfb443194de1a0ab3bef5]) Fix tem...
- 2315 ActionView::Template extension processing bug (from [ae9f258e03c9fd5088da12c1c6cd216cc89a01f7]) Fix tem...
- 2284 ActionView::Template doesn't support multipart formats with locale (from [ae9f258e03c9fd5088da12c1c6cd216cc89a01f7]) Fix tem...