Class: SuperSettings::Storage::ActiveRecordStorage::Model
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SuperSettings::Storage::ActiveRecordStorage::Model
- Defined in:
- lib/super_settings/storage/active_record_storage/models.rb
Class Method Summary collapse
-
.available? ⇒ Boolean
ActiveRecord storage is only available if the connection pool is connected and the table exists.
Class Method Details
.available? ⇒ Boolean
ActiveRecord storage is only available if the connection pool is connected and the table exists.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/super_settings/storage/active_record_storage/models.rb', line 19 def available? begin # table_exists? will attempt to retrieve a connection from the pool and load the schema_cache # which is memoized per connection. If there is no database or connection, it will raise an error. table_exists? rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished # Ignore errors so the application doesn't break if the database is not available. # Otherwise things like build processes can fail. false end end |