Skip to content
Browse files

Seems like in older versions of AR fixnums were converted to strings …

…in serialized column
  • Loading branch information...
1 parent 7834c75 commit b5f955e2006b79b2f294d0f45ed791723cd6e11e @drogus committed
Showing with 2 additions and 2 deletions.
  1. +1 −1 app/models/tolk/translation.rb
  2. +1 −1 test/unit/format_test.rb
View
2 app/models/tolk/translation.rb
@@ -41,6 +41,7 @@ def primary_translation
end
def text=(value)
+ value = value.to_s if value.kind_of?(Fixnum)
super unless value.to_s == text
end
@@ -86,7 +87,6 @@ def fix_text_type
rescue ArgumentError
nil
end
-
end
self.text = nil if primary_translation.text.class != self.text.class
View
2 test/unit/format_test.rb
@@ -98,7 +98,7 @@ def test_bulk_translations_update_with_some_invalid_formats
@spanish.translations_attributes = [
{"locale_id" => @spanish.id, "phrase_id" => ph('string_array').id, "text" => 'invalid format'},
{"locale_id" => @spanish.id, "phrase_id" => ph('string').id, "text" => 'spanish string'},
- {"locale_id" => @spanish.id, "phrase_id" => ph('string').id, "text" => 'bla'}
+ {"locale_id" => @spanish.id, "phrase_id" => ph('number').id, "text" => '2'}
]
assert_difference('Tolk::Translation.count', 2) { @spanish.save }

0 comments on commit b5f955e

Please sign in to comment.
Something went wrong with that request. Please try again.