Method: ActiveRecord::DatabaseConfigurations#primary?

Defined in:
activerecord/lib/active_record/database_configurations.rb

#primary?(name) ⇒ Boolean

A primary configuration is one that is named primary or if there is no primary, the first configuration for an environment will be treated as primary. This is used as the “default” configuration and is used when the application needs to treat one configuration differently. For example, when Rails dumps the schema, the primary configuration’s schema file will be named ‘schema.rb` instead of `primary_schema.rb`.

Returns:

  • (Boolean)


136
137
138
139
140
141
# File 'activerecord/lib/active_record/database_configurations.rb', line 136

def primary?(name) # :nodoc:
  return true if name == "primary"

  first_config = find_db_config(default_env)
  first_config && name == first_config.name
end