Closed eljojo closed 10 years ago
Hmmm, thinking back about it, this has the drawback that translations will not be able to be set empty again. please don't merge this.
cool, I won't
ok, I fixed the bug and at the same time fixed another bug. I noticed the system wasn't able to set translations back to an empty value. This test (just wrote it) wasn't passing:
test "not persisted translations can be set to empty values" do
u = Unit.new(:name_en => "test")
u.name_en = ""
assert_equal "", u.translations.first.name
end
What I don't get is the different behaviour of globalize in rails 3 and rails 4. In rails 4, it always creates a translation for for the default locale, whereas in rails 3 it doesn't create any.
ok, so I changed the test. It will make sure that the polish translation is not created, regardless of the english one.
fixed!
Thanks!
Hi, if an accessor is used to set an empty value the translation is still created after saving, because
write_attribute
is still being called.this fixes that behaviour.