This project is archived and is in readonly mode.
Layout lookup fails when a template has locale in its filename
Reported by Eugene Pimenov | January 24th, 2010 @ 02:09 AM
In Rails3 I get an error when trying to render a template with locale in its filename.
The repro code is (copied from the attached test):
class WithLocaleInTemplate < Base
layout "hello"
def index
render 'hello_world'
end
end
hello_world, for example, is hello_world.en.html.erb
Exception I get:
NoMethodError: You specified nil as the layout, but no such method was found
rails/actionpack/lib/abstract_controller/layouts.rb:397:in `_default_layout'
Actual exception is
undefined method `|' for :en:Symbol
rails/actionpack/lib/action_view/template/resolver.rb:15:in `register_detail'
rails/actionpack/lib/action_view/template/resolver.rb:59:in `call'
rails/actionpack/lib/action_view/template/resolver.rb:59:in `normalize_detail'
but it's hidden behind rescue NoMethodError in _default_layout.
The fix is one-liner:
- locale = details.last && details.pop.to_sym
+ locale = details.last && [details.pop.to_sym]
Comments and changes to this ticket
-
Eugene Pimenov February 4th, 2010 @ 02:53 PM
DeOMGfying has introduced conflicts to the patch. Nothing else has changed in patch.
-
Rohit Arondekar October 7th, 2010 @ 11:25 AM
- State changed from new to resolved
- Importance changed from to Low
I manually applied the test and it passed. This must have been fixed along the way.
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>