0
0
Fork 0

Fix boolean columns sometimes having a null value (#4162)

* Fix boolean columns sometimes having a null value

* Fix wrong value being set instead of null
This commit is contained in:
Eugen Rochko 2017-07-13 03:12:25 +02:00 committed by GitHub
parent e48d3bfd01
commit 880a5eb25c
6 changed files with 31 additions and 13 deletions

View file

@ -12,12 +12,12 @@
# in_reply_to_id :integer
# reblog_of_id :integer
# url :string
# sensitive :boolean default(FALSE)
# sensitive :boolean default(FALSE), not null
# visibility :integer default("public"), not null
# in_reply_to_account_id :integer
# application_id :integer
# spoiler_text :text default(""), not null
# reply :boolean default(FALSE)
# reply :boolean default(FALSE), not null
# favourites_count :integer default(0), not null
# reblogs_count :integer default(0), not null
# language :string
@ -249,6 +249,7 @@ class Status < ApplicationRecord
def set_visibility
self.visibility = (account.locked? ? :private : :public) if visibility.nil?
self.sensitive = false if sensitive.nil?
end
def set_sensitivity