When there is no connection, answer false (#13417)
When building containers, when there is no postgresql instance, this check to AR::Base.connection is raising an error. We'd like to be able to continue running `rake assets:precompile` without needing a live db to check the schema for a table. Handle connection errors as though they were a table missing.
This commit is contained in:
parent
f45213e5c9
commit
a14adaa689
1 changed files with 1 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ module Database
|
|||
# @param table [String] the name of the table to check for
|
||||
def self.table_exists?(table)
|
||||
ActiveRecord::Base.connection.table_exists?(table)
|
||||
rescue ActiveRecord::NoDatabaseError
|
||||
rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue