Class: Railswatch::Models::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/railswatch/models/application_record.rb

Direct Known Subclasses

BaseRecord

Class Method Summary collapse

Class Method Details

.reset_storage_connection!Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/railswatch/models/application_record.rb', line 9

def reset_storage_connection!
  target = Railswatch.database_connection_name.presence&.to_s
  if target.blank?
    remove_connection
  else
    establish_connection(resolve_connection_name(target).to_sym)
  end
rescue ActiveRecord::ConnectionNotEstablished
  nil
end