Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: ruby
services:
- docker
rvm:
- jruby-9.1.17.0
- jruby-9.2.11.0
- 2.1.9
- 2.2.9
- 2.3.6
Expand Down
2 changes: 0 additions & 2 deletions lib/apartment/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ class Railtie < Rails::Railtie
Apartment.connection_class.connection_pool.with_connection do
Apartment::Tenant.init
end
# rubocop:disable Lint/SuppressedException
rescue ::ActiveRecord::NoDatabaseError, PG::ConnectionBad
# Since `db:create` and other tasks invoke this block from Rails 5.2.0,
# we need to swallow the error to execute `db:create` properly.
Rails.logger.warn do
'Failed to initialize Apartment because a database connection could not be established.'
end
end
# rubocop:enable Lint/SuppressedException
end

#
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/apartment.rake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apartment_namespace = namespace :apartment do
begin
puts("Dropping #{tenant} tenant")
Apartment::Tenant.drop(tenant)
rescue Apartment::TenantNotFound => e
rescue Apartment::TenantNotFound, ActiveRecord::NoDatabaseError => e
puts e.message
end
end
Expand Down