-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #188 from rails-on-services/development
**Implemented enhancements:** - Increase errors visibility by showing more information on the underlying error rather than a generic error 'Apartment::TenantNotFound' (#176) - Resolved #177 - Added rails 7 support (#178) **Fixed bugs:** - Fixing tenant_presence_check config in the README (#180) - Resolved #161 and #81 - Fixed sequence name (#187) **Closed issues:** - Resolved #151 - removed reloader and console overwrite of reload method (#174)
- Loading branch information
Showing
27 changed files
with
111 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.7.3 | ||
2.7.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "rails", "~> 7.0.0" | ||
|
||
platforms :ruby do | ||
gem "sqlite3", "~> 1.4" | ||
end | ||
|
||
platforms :jruby do | ||
gem "activerecord-jdbc-adapter", "~> 61.0" | ||
gem "activerecord-jdbcpostgresql-adapter", "~> 61.0" | ||
gem "activerecord-jdbcmysql-adapter", "~> 61.0" | ||
end | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
# rubocop:disable Style/ClassAndModuleChildren | ||
|
||
# NOTE: This patch is meant to remove any schema_prefix appart from the ones for | ||
# excluded models. The schema_prefix would be resolved by apartment's setting | ||
# of search path | ||
module Apartment::PostgreSqlAdapterPatch | ||
def default_sequence_name(table, _column) | ||
res = super | ||
schema_prefix = "#{Apartment::Tenant.current}." | ||
default_tenant_prefix = "#{Apartment::Tenant.default_tenant}." | ||
|
||
# NOTE: Excluded models should always access the sequence from the default | ||
# tenant schema | ||
if excluded_model?(table) | ||
res.sub!(schema_prefix, default_tenant_prefix) if schema_prefix != default_tenant_prefix | ||
return res | ||
end | ||
|
||
res.delete_prefix!(schema_prefix) if res&.starts_with?(schema_prefix) | ||
|
||
res | ||
end | ||
|
||
private | ||
|
||
def excluded_model?(table) | ||
Apartment.excluded_models.any? { |m| m.constantize.table_name == table } | ||
end | ||
end | ||
|
||
require 'active_record/connection_adapters/postgresql_adapter' | ||
|
||
# NOTE: inject this into postgresql adapters | ||
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | ||
include Apartment::PostgreSqlAdapterPatch | ||
end | ||
# rubocop:enable Style/ClassAndModuleChildren |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.