brick 1.0.222 → 1.0.223

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: b3e0a0e804ed376999842c2f8f31ba5b2db0ca019bce0e94b6b85b5869256667
4
- data.tar.gz: 27cea38b19cec28e95515256aafd2e4a7fb1a220d3147d1123edd2ac74aa45b3
3
+ metadata.gz: 7358b611b9073f3fafe55e9d3ac4b5d19ebba01604607f7aaf51eaa1b514ef6b
4
+ data.tar.gz: 29adea32add038493e6f65ab1d426b378214861d9e2a61c0892ffee1a65e55bd
5
5
  SHA512:
6
- metadata.gz: 4de80d5d689bb00369190f4b02093f56320309e6de856ed1e69ca570996e73987d6c27bbe3cfd124fae9ec274a19411d3935900c16e1d81e19cd40542f3714da
7
- data.tar.gz: 453ac262c8314586ec6b1f68051871288659d4efffdbc442880efdae06ab435637508f7667e7dea93d543bbe82b291523d36fc2bfd67f801852c5416db8acdf6
6
+ metadata.gz: c3c21da00d78d98e635c8986c939530fce1f9b18326d4c40c478cb48aa04bd52617c932eea9872f1142180de351d27936f16dd943cc955b3ad714db000800608
7
+ data.tar.gz: 26ddbd8d7c7378448dadae1cf6d00dad47221fe5059012fc39c0bf6b1b4745ee9fa63f88e76888ff64e873a20d6a4322099817aaadf565a32254cf0e99911dc0
@@ -1657,8 +1657,8 @@ class Object
1657
1657
  base_name.pluralize].find { |s| Brick.db_schemas&.include?(s) }
1658
1658
  end
1659
1659
  plural_class_name = ActiveSupport::Inflector.pluralize(model_name = class_name)
1660
- # If it's namespaced then we turn the first part into what would be a schema name
1661
- singular_table_name = ActiveSupport::Inflector.underscore(model_name).gsub('/', '.')
1660
+ # gsub is so that if it's namespaced then we turn the first part into what would be a schema name
1661
+ singular_table_name = ::Brick.table_name_lookup[model_name] || ActiveSupport::Inflector.underscore(model_name).gsub('/', '.')
1662
1662
 
1663
1663
  if base_model
1664
1664
  table_name = base_model.table_name
@@ -181,10 +181,10 @@ function linkSchemas() {
181
181
  end
182
182
  end
183
183
 
184
+ Module.class_exec &::Brick::ADD_CONST_MISSING # Load it once at the start ...
185
+ # ... and also for Rails >= 5.0, whenever the app gets reloaded
184
186
  if ::Rails.application.respond_to?(:reloader)
185
187
  ::Rails.application.reloader.to_prepare { Module.class_exec &::Brick::ADD_CONST_MISSING }
186
- else # For Rails < 5.0, just load it once at the start
187
- Module.class_exec &::Brick::ADD_CONST_MISSING
188
188
  end
189
189
  end
190
190
 
@@ -99,6 +99,8 @@ module Brick::Rails::FormTags
99
99
  # proxy = relation.instance_variable_get(:@proxy) || relation.instance_variable_set(:@proxy, {})
100
100
  bi = relation.instance_variable_get(:@_brick_includes)
101
101
  relation.each do |obj|
102
+ next unless klass.table_exists?
103
+
102
104
  rid = pk.map { |pk_part| obj.send(pk_part.to_sym) }
103
105
  out << "<tr x-id=\"#{rid.join('/')}\">\n"
104
106
  out << "<td class=\"col-sticky alternating-gray\">#{link_to('⇛', send("#{klass._brick_index(:singular)}_path".to_sym, rid),
@@ -785,6 +787,9 @@ function onImagesLoaded(event) {
785
787
  end
786
788
  klass_or_obj = klass_or_obj.klass
787
789
  end
790
+ klass = klass_or_obj.is_a?(ActiveRecord::Base) ? klass_or_obj.class : klass_or_obj
791
+ return unless klass.table_exists?
792
+
788
793
  if klass_or_obj.is_a?(Class) && klass_or_obj <= ActiveRecord::Base
789
794
  type_col = klass_or_obj.inheritance_column
790
795
  if klass_or_obj.column_names.include?(type_col) && klass_or_obj.name != klass_or_obj.base_class.name
@@ -793,7 +798,6 @@ function onImagesLoaded(event) {
793
798
  end
794
799
  filter = "?#{filter_parts.join('&')}" if filter_parts.present?
795
800
  app_routes = Rails.application.routes # In case we're operating in another engine, reference the application since Brick routes are placed there.
796
- klass = klass_or_obj.is_a?(ActiveRecord::Base) ? klass_or_obj.class : klass_or_obj
797
801
  relation = ::Brick.relations.fetch(rel_name || klass.table_name, nil)
798
802
  if (klass_or_obj&.is_a?(Class) && klass_or_obj < ActiveRecord::Base) ||
799
803
  (klass_or_obj&.is_a?(ActiveRecord::Base) && klass_or_obj.new_record? && (klass_or_obj = klass_or_obj.class))
@@ -8,6 +8,9 @@ module Brick
8
8
 
9
9
  # return if ActiveRecord::Base.connection.current_database == 'postgres'
10
10
 
11
+ # Accommodate funky table names for Salesforce mode
12
+ ::Brick.apply_double_underscore_patch if ::Brick.config.salesforce_mode
13
+
11
14
  # Utilise Elasticsearch indexes, if any
12
15
  if Object.const_defined?('Elasticsearch')
13
16
  if ::Elasticsearch.const_defined?('Client')
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 222
8
+ TINY = 223
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
@@ -147,7 +147,8 @@ module Brick
147
147
  pkey_cols.include?(col)
148
148
 
149
149
  begin
150
- if (val = obj.send(col)) && (val.is_a?(Time) || val.is_a?(Date))
150
+ # Used to be: obj.send(col)
151
+ if (val = obj.attributes_before_type_cast[col]) && (val.is_a?(Time) || val.is_a?(Date))
151
152
  val = val.to_s
152
153
  end
153
154
  rescue StandardError => e # ActiveRecord::Encryption::Errors::Configuration
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.222
4
+ version: 1.0.223
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord