brick 1.0.184 → 1.0.185

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78b2c6e3f1da384e5310953f39a9bb08f85bdeabf7d2cf4143e483ad4df9f146
4
- data.tar.gz: e3bb0fc597cfb9908a87667b6e785f41dc73337fd834151dd8ce41af8aabca02
3
+ metadata.gz: d930911e6903179271b74220c325ba024dfebe26f87eec06111772bfe1dd6b39
4
+ data.tar.gz: fb0767bf7e59c56dffbe1999ee86ca3cefe66040dd26387019f2d45b8776fcd3
5
5
  SHA512:
6
- metadata.gz: d1f52d74e8feca2255c86423b4108ddad31daa3b49c4f54ae0c25080542e51e1b1a812238ea6313de51c2644f67ac4ab5ad7c9759fbfb535a07e8c3134010f39
7
- data.tar.gz: 9b21a929ef26076909595907bfda0d74b73d274bb6442d58eb80beb4b152b6aaf97ec8a8177dc0057df9188dcfde9e9540f1573c6b59ae6be62b40ac0a7541d8
6
+ metadata.gz: d03584188eaf7ba5a41b37fd80470f6eeb8c166949f4e19f1e2a9ccf958b94d0864c25f16363fbaae1980c36d8e82ec0eacf731cd5bdee97ec819a68be4b9836
7
+ data.tar.gz: 5fc2966228117b7d35e5370ff64f2f46e85e8bfa8a1a4a4df8732e91fe0e0f4c0a5050cc7b77d44217538a7bc46681a24ebd03d0fc6ff69f483f7a7861f74a38
@@ -48,10 +48,14 @@ if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('2.7')
48
48
  end
49
49
  end
50
50
 
51
- unless ActiveRecord.const_defined?(:NoDatabaseError) # Generic version of NoDatabaseError for Rails <= 4.0
51
+ unless ActiveRecord.const_defined?(:NoDatabaseError)
52
52
  require 'active_model'
53
+ require 'active_record/deprecator' if ActiveRecord.version >= Gem::Version.new('7.1.0')
53
54
  require 'active_record/errors'
54
- class ::ActiveRecord::NoDatabaseError < ::ActiveRecord::StatementInvalid
55
+ # Generic version of NoDatabaseError for Rails <= 4.0
56
+ unless ActiveRecord.const_defined?(:NoDatabaseError)
57
+ class ::ActiveRecord::NoDatabaseError < ::ActiveRecord::StatementInvalid
58
+ end
55
59
  end
56
60
  end
57
61
 
@@ -1966,7 +1966,7 @@ document.querySelectorAll(\"input, select\").forEach(function (inp) {
1966
1966
  def viable_models
1967
1967
  return _brick_viable_models if ::RailsAdmin::Config.class_variables.include?(:@@system_models)
1968
1968
 
1969
- brick_models = ::Brick.relations.map { |_k, v| v[:class_name] }
1969
+ brick_models = ::Brick.relations.each_with_object([]) { |rel, s| s << rel.last[:class_name] unless rel.first.is_a?(Symbol) }
1970
1970
 
1971
1971
  # The original from RailsAdmin (now aliased as _brick_viable_models) loads all classes
1972
1972
  # in the whole project. This Brick approach is a little more tame.
@@ -1999,7 +1999,7 @@ document.querySelectorAll(\"input, select\").forEach(function (inp) {
1999
1999
  end
2000
2000
 
2001
2001
  RailsAdmin.config do |config|
2002
- ::Brick.relations.select { |_k, v| v.key?(:isView) }.each do |_k, relation|
2002
+ ::Brick.relations.select { |_k, v| v.is_a?(Hash) && v.key?(:isView) }.each do |_k, relation|
2003
2003
  config.model(relation[:class_name]) do # new_model_class
2004
2004
  list do
2005
2005
  sort_by (sort_col = relation[:cols].first.first)
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 184
8
+ TINY = 185
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
data/lib/brick.rb CHANGED
@@ -162,6 +162,8 @@ module Brick
162
162
  h[:db_name] = db_name if db_name
163
163
  end
164
164
  end
165
+ rescue ActiveRecord::NoDatabaseError
166
+ {}
165
167
  end
166
168
 
167
169
  def apartment_multitenant
@@ -1916,7 +1918,7 @@ module ActiveRecord
1916
1918
  private
1917
1919
 
1918
1920
  # %%% Pretty much have to flat-out replace this guy (I think anyway)
1919
- # Good with Rails 5.24 through 7 on this
1921
+ # Good with Rails 5.2.4 through 7.1 on this
1920
1922
  # Ransack gem includes Polyamorous which replaces #build in a different way (which we handle below)
1921
1923
  unless Gem::Specification.all_names.any? { |g| g.start_with?('ransack-') }
1922
1924
  def build(associations, base_klass, root = nil, path = '')
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.184
4
+ version: 1.0.185
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord