Class: Railscope::ApplicationRecord
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Railscope::ApplicationRecord
- Defined in:
- app/models/railscope/application_record.rb
Direct Known Subclasses
Class Method Summary collapse
-
.railscope_separate_database? ⇒ Boolean
Support for separate database connection.
Class Method Details
.railscope_separate_database? ⇒ Boolean
Support for separate database connection. Activated when a "railscope" database is defined in database.yml or when RAILSCOPE_DATABASE_URL is set.
Example database.yml:
development:
primary:
<<: *default
database: myapp_development
migrations_paths: db/migrate
railscope:
<<: *default
database: myapp_railscope_development
migrations_paths: db/railscope_migrate
22 23 24 25 26 27 28 29 |
# File 'app/models/railscope/application_record.rb', line 22 def self.railscope_separate_database? return true if ENV["RAILSCOPE_DATABASE_URL"].present? configs = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env) configs.any? { |c| c.name == "railscope" } rescue StandardError false end |