Allows multiple records to have empty identity_url without hitting
unique constraint.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
uniqueness: true,
allow_nil: true)
validate :must_unsetup_to_deactivate
+ validate :identity_url_nil_if_empty
before_update :prevent_privilege_escalation
before_update :prevent_inactive_admin
before_update :verify_repositories_empty, :if => Proc.new {
repo.save!
end
end
+
+ def identity_url_nil_if_empty
+ if identity_url == ""
+ self.identity_url = nil
+ end
+ end
end
assert user.save
end
+ test "empty identity_url saves as null" do
+ set_user_from_auth :admin
+ user = users(:active)
+ assert user.update_attributes(identity_url: '')
+ user.reload
+ assert_nil user.identity_url
+ end
+
end