Permalink
Browse files

fix nested object i18n scopes order

add failing spec for issue #613
  • Loading branch information...
1 parent a77267c commit 8da6eaec3a9886d29a25e9050206c8c2f213ef90 @crystalin crystalin committed Sep 16, 2011
Showing with 14 additions and 2 deletions.
  1. +3 −2 lib/formtastic/i18n.rb
  2. +11 −0 spec/i18n_spec.rb
View
@@ -8,10 +8,11 @@ module I18n
DEFAULT_VALUES = YAML.load_file(File.expand_path("../../locale/en.yml", __FILE__))["en"]["formtastic"].freeze
SCOPES = [
'%{model}.%{nested_model}.%{action}.%{attribute}',
- '%{model}.%{action}.%{attribute}',
'%{model}.%{nested_model}.%{attribute}',
- '%{model}.%{attribute}',
+ '%{nested_model}.%{action}.%{attribute}',
'%{nested_model}.%{attribute}',
+ '%{model}.%{action}.%{attribute}',
+ '%{model}.%{attribute}',
'%{attribute}'
]
View
@@ -160,6 +160,17 @@
output_buffer.should have_tag("form label", /Hello author name!/)
end
end
+
+ it 'should be able to translate nested objects with nested object translations' do
+ with_config :i18n_lookups_by_default, true do
+ concat(semantic_form_for(@new_post) do |builder|
+ builder.semantic_fields_for(:project) do |f|
+ concat(f.input(:title))
+ end
+ end)
+ output_buffer.should have_tag("form label", /Hello project!/)
+ end
+ end
it 'should be able to translate nested forms with top level translations' do
with_config :i18n_lookups_by_default, true do

0 comments on commit 8da6eae

Please sign in to comment.