Fixed issue with migration running on empty db (#812)

This commit is contained in:
Ahmad Farhat 2019-10-10 15:17:52 -04:00 committed by Jesus Federico
parent 4a791ae0b5
commit c14f4dc31c
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ module Deleteable
extend ActiveSupport::Concern
included do
# By default don't include deleted
default_scope { where(deleted: false) }
# By default don't include deleted if the column has been created
default_scope { where(deleted: false) } if column_names.include? 'deleted'
scope :include_deleted, -> { unscope(where: :deleted) }
scope :deleted, -> { include_deleted.where(deleted: true) }
end