Module: RuboCop::Cop::DatabaseTypeResolvable

Included in:
Rails::BulkChangeTable, Rails::NotNullColumn
Defined in:
lib/rubocop/cop/mixin/database_type_resolvable.rb

Overview

A mixin to extend cops in order to determine the database type.

This module automatically detect an adapter from ‘development` environment in `config/database.yml` or the environment variable `DATABASE_URL` when the `Database` option is not set.

Constant Summary collapse

MYSQL =
'mysql'
POSTGRESQL =
'postgresql'

Instance Method Summary collapse

Instance Method Details

#databaseObject



14
15
16
# File 'lib/rubocop/cop/mixin/database_type_resolvable.rb', line 14

def database
  cop_config['Database'] || database_from_yaml || database_from_env
end