Module: Cms::Extensions::ActiveRecord::ClassMethods
- Defined in:
- lib/cms/extensions/active_record/base.rb
Instance Method Summary collapse
-
#database_exists? ⇒ Boolean
Determines if the database for this Rails App exists yet.
Instance Method Details
#database_exists? ⇒ Boolean
Determines if the database for this Rails App exists yet. Useful for methods which might be called during rake tasks or initialize where a database not yet being created is not fatal, but should be ignored.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cms/extensions/active_record/base.rb', line 20 def database_exists? begin connection return true rescue StandardError # Hopefully this works with MySql, MySql2 and SQLite logger.warn "Attempted to establish a connection with the database, but could not do so." return false end end |