diff options
author | Henare Degan <henare.degan@gmail.com> | 2015-04-11 16:38:26 +1000 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2015-04-11 16:38:26 +1000 |
commit | db143557a9bbfd2d92ebff6f4cb0139da50c5d44 (patch) | |
tree | 6cfc98c2dcacc5fb7a18559f2b99037ff81d000a | |
parent | 8c72a2590a6c0a5f21491b96f44eeb8da53663bd (diff) |
Check for blank values, not just an empty string
On my machine the integration test "Editing a Public Body can add a
translation for multiple locales" (http://git.io/vvv9t) was failing
because when it submitted the form to update one locale it created
empty records for all locales resulting in the test
(http://git.io/vvv93) for a nil locale to fail.
It was doing this because when it submitted the form it included a
notes field with a single newline character and so this method
evaluated as false and therefore a largely blank translation was
created.
-rw-r--r-- | app/models/public_body.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 232c0ffa1..e1d748582 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -775,7 +775,7 @@ class PublicBody < ActiveRecord::Base def empty_translation_in_params?(attributes) attrs_with_values = attributes.select do |key, value| - value != '' and key.to_s != 'locale' + !value.blank? and key.to_s != 'locale' end attrs_with_values.empty? end |