Fix: user email should be null instead of empty string

This commit is contained in:
Ilya Konanykhin
2017-01-31 23:46:10 +06:00
parent b8ba64ab93
commit 45e14a1070
3 changed files with 22 additions and 2 deletions
+5
View File
@@ -54,6 +54,11 @@ class User < ActiveRecord::Base
roles.include?(role)
end
# try keeping the email field in DB clear and consistent, without empty strings (NULLs instead)
def email=(other)
super(other.blank? ? nil : other)
end
### TODO methods below probably belong somewhere else
def completed_build_bikes