[openstreetmap/openstreetmap-website] Specifiy invalid chars in username error message (#2044)
Jamie Guthrie
notifications at github.com
Mon Nov 5 02:27:08 UTC 2018
@tomhughes @gravitystorm How should `display_name: nil` be handled?
The database has a NOT NULL constraint, but the validations explicitly state `allow_nil: true` and the original tests expected nil to pass
https://github.com/openstreetmap/openstreetmap-website/blob/b931d6f516d049ac42fcd70f33f130c252f5d0a9/test/unit/user_test.rb#L65-L69
user.display_name = nil
# Don't understand why it isn't allowing a nil value,
# when the validates statements specifically allow it
# It appears the database does not allow null values
assert !user.valid?
I've figured out why the validations were rejecting nil (the leading/trailing whitespaces validations were triggering on nil)
The new code now allows for a nil value to actually be valid now, providing thats the actual desired behaviour..
So, should nil be a valid value for display_name at the rails-level validations? (even though the database will reject it!) It doesn't really make sense to me to not validate against it
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2044#issuecomment-435736677
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20181104/455ea9d3/attachment.html>
More information about the rails-dev
mailing list