brick 1.0.86 → 1.0.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/extensions.rb +14 -4
- data/lib/brick/version_number.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b178117c13e6d4feb053c27334b558285765a68a8bdc00c0a1d7a0a708ab3e70
|
4
|
+
data.tar.gz: b4b90b2cef91df1797d3a6534d6658914000b01542fe244d7560d31922c2125e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7866357360543e3af339aced9e7ff8c1dff803f3f92eebb12926b5cefb4da18415003b729ad5aca3b7771a145035963bd1e49d8a46096bb943a161e4b33ca79
|
7
|
+
data.tar.gz: b2978cf99f81c2ad59b04f656c189763d230542e9eb9d9eb7d3a922c609e79354926357320967f7de53a1a6cc4ec55b61811395138e632cb0f1a96993a31e926
|
data/lib/brick/extensions.rb
CHANGED
@@ -211,7 +211,14 @@ module ActiveRecord
|
|
211
211
|
this_obj = obj
|
212
212
|
bracket_name.split('.').each do |part|
|
213
213
|
obj_name += ".#{part}"
|
214
|
-
this_obj =
|
214
|
+
this_obj = begin
|
215
|
+
caches.fetch(obj_name) { caches[obj_name] = this_obj&.send(part.to_sym) }
|
216
|
+
rescue
|
217
|
+
clsnm = part.camelize
|
218
|
+
if (possible = this_obj.class.reflect_on_all_associations.select { |a| a.class_name == clsnm || a.klass.base_class.name == clsnm }.first)
|
219
|
+
caches[obj_name] = this_obj&.send(possible.name)
|
220
|
+
end
|
221
|
+
end
|
215
222
|
break if this_obj.nil?
|
216
223
|
end
|
217
224
|
if this_obj.is_a?(ActiveRecord::Base) && (obj_descrip = this_obj.class.brick_descrip(this_obj))
|
@@ -1797,6 +1804,8 @@ end.class_exec do
|
|
1797
1804
|
# This is done separately so that during testing it can be called right after a migration
|
1798
1805
|
# in order to make sure everything is good.
|
1799
1806
|
def _brick_reflect_tables
|
1807
|
+
return unless ::Brick.config.mode == :on
|
1808
|
+
|
1800
1809
|
# return if ActiveRecord::Base.connection.current_database == 'postgres'
|
1801
1810
|
|
1802
1811
|
initializer_loaded = false
|
@@ -1870,8 +1879,9 @@ end.class_exec do
|
|
1870
1879
|
::Brick.db_schemas ||= {}
|
1871
1880
|
|
1872
1881
|
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
|
1873
|
-
if (
|
1874
|
-
|
1882
|
+
if (possible_schemas = ::Brick.config.schema_behavior&.[](:multitenant)&.[](:schema_to_analyse))
|
1883
|
+
possible_schemas = [possible_schemas] unless possible_schemas.is_a?(Array)
|
1884
|
+
if (possible_schema = possible_schemas.find { |ps| ::Brick.db_schemas.key?(ps) })
|
1875
1885
|
::Brick.default_schema = schema = possible_schema
|
1876
1886
|
orig_schema = ActiveRecord::Base.execute_sql('SELECT current_schemas(true)').first['current_schemas'][1..-2].split(',')
|
1877
1887
|
ActiveRecord::Base.execute_sql("SET SEARCH_PATH = ?", schema)
|
@@ -1881,7 +1891,7 @@ end.class_exec do
|
|
1881
1891
|
orig_schema = ActiveRecord::Base.execute_sql('SELECT current_schemas(true)').first['current_schemas'][1..-2].split(',')
|
1882
1892
|
ActiveRecord::Base.execute_sql("SET SEARCH_PATH = ?", schema)
|
1883
1893
|
else
|
1884
|
-
puts "*** In the brick.rb initializer the line \"::Brick.schema_behavior = ...\" refers to
|
1894
|
+
puts "*** In the brick.rb initializer the line \"::Brick.schema_behavior = ...\" refers to schema(s) called #{possible_schemas.map { |s| "\"#{s}\"" }.join(', ')}. No mentioned schema exists. ***"
|
1885
1895
|
end
|
1886
1896
|
end
|
1887
1897
|
end
|
data/lib/brick/version_number.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.87
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorin Thwaits
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|