I’ve decided to move my rails2 project to rails3 (and ruby 1.9.2). I have such template:
%table
%thead
- I18n.with_options :scope => [:activerecord, :attributes, :segment] do |i18n|
%tr
%th= i18n.t :name
%th= i18n.t :network
%th= i18n.t :vlan
%th
%tbody
...something here...
It works fine on rails2 in both development and production modes. But on rails 3.0.3 and haml 3.0.25 production mode generates incorrect html: http://pastebin.com/mJLk8sSs, ‘table’ tag appears twice (and thead repeated twice as well).
In development mode html is correct. It’s also correct in production if I set ‘ugly’ haml option to false.
This issue was fixed in rails 3.0.2 (only using erb as far as I can tell)
see: https://rails.lighthouseapp.com/projects/8994/tickets/4429-templates-that-use-with_options
It appears to still be broken using rails 3.0.3 with haml 3.0.25. There has been some talk on the haml mailing list about it, though I don’t think anything has been done yet.
(http://osdir.com/ml/haml/2010-08/msg00107.html)
To solve this issue I have simply removed with_options from my templates. You could alternatively assign your options to a variable and pass that to each call of
t.