Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cookbooks
tmp
spec/dummy/db/*.sqlite3
.DS_Store
.ruby-version
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ rvm:
- 2.4.3
- 2.5.0
- 2.6.2
- 2.7.2
- ruby-head
gemfile:
- gemfiles/rails_4_2.gemfile
- gemfiles/rails_5_0.gemfile
- gemfiles/rails_5_1.gemfile
- gemfiles/rails_5_2.gemfile
- gemfiles/rails_6_0.gemfile
- gemfiles/rails_6_1.gemfile
- gemfiles/rails_master.gemfile
bundler_args: --without local
before_install:
Expand Down Expand Up @@ -44,6 +46,8 @@ matrix:
gemfile: gemfiles/rails_5_2.gemfile
- rvm: 2.1.9
gemfile: gemfiles/rails_6_0.gemfile
- rvm: 2.1.9
gemfile: gemfiles/rails_6_1.gemfile
- rvm: 2.1.9
gemfile: gemfiles/rails_master.gemfile
- rvm: 2.2.9
Expand All @@ -52,12 +56,16 @@ matrix:
gemfile: gemfiles/rails_6_0.gemfile
- rvm: 2.4.3
gemfile: gemfiles/rails_6_0.gemfile
- rvm: 2.4.3
gemfile: gemfiles/rails_6_1.gemfile
- rvm: jruby-9.1.15.0
gemfile: gemfiles/rails_5_1.gemfile
- rvm: jruby-9.1.15.0
gemfile: gemfiles/rails_5_2.gemfile
- rvm: jruby-9.1.15.0
gemfile: gemfiles/rails_6_0.gemfile
- rvm: jruby-9.1.15.0
gemfile: gemfiles/rails_6_1.gemfile
- rvm: jruby-9.1.15.0
gemfile: gemfiles/rails_master.gemfile
fast_finish: true
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ def migrate
if activerecord_below_5_2?
ActiveRecord::Migrator.migrate('spec/dummy/db/migrate')
else
ActiveRecord::MigrationContext.new('spec/dummy/db/migrate').migrate
ActiveRecord::MigrationContext.new('spec/dummy/db/migrate', ActiveRecord::Base.connection.schema_migration).migrate
end
end
4 changes: 2 additions & 2 deletions apartment.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.licenses = ["MIT"]

# must be >= 3.1.2 due to bug in prepared_statements
s.add_dependency 'activerecord', '>= 3.1.2', '< 6.1'
s.add_dependency 'activerecord', '>= 3.1.2', '<= 6.1'
s.add_dependency 'rack', '>= 1.3.6'
s.add_dependency 'public_suffix', '>= 2'
s.add_dependency 'parallel', '>= 0.7.1'
Expand All @@ -41,6 +41,6 @@ Gem::Specification.new do |s|
else
s.add_development_dependency 'mysql2'
s.add_development_dependency 'pg'
s.add_development_dependency 'sqlite3', '~> 1.3.6'
s.add_development_dependency 'sqlite3', '~> 1.4.2'
end
end
22 changes: 22 additions & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 6.1.0"

group :local do
gem "pry"
gem "guard-rspec", "~> 4.2"
end

platforms :ruby do
gem "sqlite3", "~> 1.4.2"
end

platforms :jruby do
gem "activerecord-jdbc-adapter", ">= 6.1"
gem "activerecord-jdbcpostgresql-adapter", ">= 6.1"
gem "activerecord-jdbcmysql-adapter", ">= 6.1"
end

gemspec path: "../"
6 changes: 5 additions & 1 deletion lib/apartment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class << self
attr_accessor(*ACCESSOR_METHODS)
attr_writer(*WRITER_METHODS)

def_delegators :connection_class, :connection, :connection_config, :establish_connection
def_delegators :connection_class, :connection, :connection_db_config, :establish_connection

# configure apartment with available options
def configure
Expand Down Expand Up @@ -99,6 +99,10 @@ def extract_tenant_config
rescue ActiveRecord::StatementInvalid
{}
end

def connection_config
connection_db_config.configuration_hash
end
end

# Exceptions
Expand Down