brick 1.0.90 → 1.0.92

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: eca72d418715811a100a44a45b3cd054ca511ed280f1d1a6f344ddaa972c220c
4
- data.tar.gz: d712ebb5dedf75da99d8d8720f4b89e29ea2e96b498b4a59540811f5e087231c
3
+ metadata.gz: 6bb6854dd2295476ae00996f23e801587869463aa7114d9240c0e97b1cce25b1
4
+ data.tar.gz: f174948106c6a06be049f8285fb3358813d09b9970ce484554ad3c86bc3cb8fb
5
5
  SHA512:
6
- metadata.gz: 1b3d3941f4905b7a3ce1489a6f018d958331bd4c2970a5ba5034eb0fb81683febdc8a93562be5a1505afe6d6479fb1ed068a0f21d6ea80f24460e9e9267b8ea3
7
- data.tar.gz: c3f61b68cd2ca5790f93b82010909f65913ccecb46df24786c83db362241092824db66833b72f03708560f23b7e87f64f12b180d8e4fb9ababba32bdb9b3f9df
6
+ metadata.gz: 9384ef5db0a03fcc8fda6a3ceafc763a468f88033420d785814d657303027593c7fef64770087975d73d4041f577864c1d934629cb50083fb93d2591f719f136
7
+ data.tar.gz: e2b3e21982b9a6d132a3d9d05041759e06a3ac3ffbfdf2ea3675ee0140150f2d33b6e60cbeb0033a7f7469bba227f198a6cc6a0ef34c229ba7a1132cd1175b0d
@@ -11,6 +11,7 @@ unless ActiveRecord.respond_to?(:version)
11
11
  end
12
12
 
13
13
  # ActiveSupport, ActionPack, and ActionView before 4.0 didn't have #version
14
+ require 'active_support' # Needed for Rails 4.x
14
15
  unless ActiveSupport.respond_to?(:version)
15
16
  module ActiveSupport
16
17
  def self.version
@@ -309,9 +309,15 @@ module ActiveRecord
309
309
  def self._brick_calculate_bts_hms(translations, join_array)
310
310
  # Add any custom columns
311
311
  ::Brick.config.custom_columns&.fetch(table_name, nil)&.each do |k, cc|
312
+ if cc.is_a?(Array)
313
+ fk_col = cc.last unless cc.last.blank?
314
+ cc = cc.first
315
+ else
316
+ fk_col = true
317
+ end
312
318
  # false = not polymorphic, and true = yes -- please emit_dsl
313
319
  pieces, my_dsl = brick_parse_dsl(join_array, [], translations, false, cc, true)
314
- _br_cust_cols[k] = [pieces, my_dsl]
320
+ _br_cust_cols[k] = [pieces, my_dsl, fk_col]
315
321
  end
316
322
  bts, hms, associatives = ::Brick.get_bts_and_hms(self)
317
323
  bts.each do |_k, bt|
@@ -401,7 +407,13 @@ module ActiveRecord
401
407
  end
402
408
 
403
409
  class Relation
404
- attr_reader :_brick_chains, :_arel_applied_aliases
410
+ attr_reader :_arel_applied_aliases
411
+
412
+ # Links from ActiveRecord association pathing names over to real
413
+ # table correlation names built from AREL aliasing
414
+ def brick_links
415
+ @brick_links ||= {}
416
+ end
405
417
 
406
418
  # CLASS STUFF
407
419
  def _recurse_arel(piece, prefix = '')
@@ -442,7 +454,6 @@ module ActiveRecord
442
454
  @_arel_applied_aliases << (alias_name = table.right)
443
455
  table = table.left
444
456
  end
445
- (_brick_chains[table._arel_table_type] ||= []) << (alias_name || table.table_alias || table.name)
446
457
  end
447
458
  # rubocop:enable Style/IdenticalConditionalBranches
448
459
  when Arel::Table # Table
@@ -451,12 +462,8 @@ module ActiveRecord
451
462
  # Can get the real table name from: self._recurse_arel(piece.left)
452
463
  names << [piece.left._arel_table_type, piece.right.to_s] # This is simply a string; the alias name itself
453
464
  when Arel::Nodes::JoinSource # Leaving this until the end because AR < 3.2 doesn't know at all about JoinSource!
454
- # Spin up an empty set of Brick alias name chains at the start
455
- @_brick_chains = {}
456
465
  # The left side is the "FROM" table
457
466
  names << (this_name = [piece.left._arel_table_type, (piece.left.table_alias || piece.left.name)])
458
- # # Do not currently need the root "FROM" table in our list of chains
459
- # (_brick_chains[this_name.first] ||= []) << this_name.last
460
467
  # The right side is an array of all JOINs
461
468
  piece.right.each { |join| names << _recurse_arel(join) }
462
469
  end
@@ -542,7 +549,6 @@ module ActiveRecord
542
549
  # Without working from a duplicate, touching the AREL ast tree sets the @arel instance variable, which causes the relation to be immutable.
543
550
  (rel_dupe = dup)._arel_alias_names
544
551
  core_selects = selects.dup
545
- chains = rel_dupe._brick_chains
546
552
  id_for_tables = Hash.new { |h, k| h[k] = [] }
547
553
  field_tbl_names = Hash.new { |h, k| h[k] = {} }
548
554
  used_col_aliases = {} # Used to make sure there is not a name clash
@@ -557,9 +563,13 @@ module ActiveRecord
557
563
  next
558
564
  end
559
565
 
566
+ key_klass = nil
567
+ key_tbl_name = nil
568
+ dest_pk = nil
569
+ key_alias = nil
560
570
  cc.first.each do |cc_part|
561
571
  dest_klass = cc_part[0..-2].inject(klass) { |kl, cc_part_term| kl.reflect_on_association(cc_part_term).klass }
562
- tbl_name = (field_tbl_names[k][cc_part.last] ||= shift_or_first(chains[dest_klass])).split('.').last
572
+ tbl_name = rel_dupe.brick_links[cc_part[0..-2].map(&:to_s).join('.')]
563
573
  # Deal with the conflict if there are two parts in the custom column named the same,
564
574
  # "category.name" and "product.name" for instance will end up with aliases of "name"
565
575
  # and "product__name".
@@ -569,31 +579,45 @@ module ActiveRecord
569
579
  used_col_aliases.key?(col_alias)
570
580
  cc_part_idx -= 1
571
581
  end
582
+ used_col_aliases[col_alias] = nil
583
+ # Set up custom column links by preparing key_klass and key_alias
584
+ # (If there are multiple different tables referenced in the DSL, we end up creating a link to the last one)
585
+ if cc[2] && (dest_pk = dest_klass.primary_key)
586
+ key_klass = dest_klass
587
+ key_tbl_name = tbl_name
588
+ cc_part_idx = cc_part.length - 1
589
+ while cc_part_idx > 0 &&
590
+ (key_alias = "br_cc_#{k}__#{(cc_part[cc_part_idx..-2] + [dest_pk]).map(&:to_s).join('__')}") &&
591
+ key_alias != col_alias && # We break out if this key alias does exactly match the col_alias
592
+ used_col_aliases.key?(key_alias)
593
+ cc_part_idx -= 1
594
+ end
595
+ end
572
596
  selects << "#{tbl_name}.#{cc_part.last} AS #{col_alias}"
573
597
  cc_part << col_alias
574
- used_col_aliases[col_alias] = nil
575
598
  end
599
+ # Add a key column unless we've already got it
600
+ if key_alias && !used_col_aliases.key?(key_alias)
601
+ selects << "#{key_tbl_name}.#{dest_pk} AS #{key_alias}"
602
+ used_col_aliases[key_alias] = nil
603
+ end
604
+ cc[2] = key_alias ? [key_klass, key_alias] : nil
576
605
  end
577
606
 
578
607
  klass._br_bt_descrip.each do |v|
579
608
  v.last.each do |k1, v1| # k1 is class, v1 is array of columns to snag
580
- next if chains[k1].nil?
609
+ next unless (tbl_name = rel_dupe.brick_links[v.first.to_s]&.split('.')&.last)
581
610
 
582
- tbl_name = (field_tbl_names[v.first][k1] ||= shift_or_first(chains[k1])).split('.').last
583
611
  # If it's Oracle, quote any AREL aliases that had been applied
584
612
  tbl_name = "\"#{tbl_name}\"" if ::Brick.is_oracle && rel_dupe._arel_applied_aliases.include?(tbl_name)
585
613
  field_tbl_name = nil
586
- v1.map { |x| [translations[x[0..-2].map(&:to_s).join('.')], x.last] }.each_with_index do |sel_col, idx|
587
- # unless chains[sel_col.first]
588
- # puts 'You might have some bogus DSL in your brick.rb file'
589
- # next
590
- # end
591
- field_tbl_name = (field_tbl_names[v.first][sel_col.first] ||= shift_or_first(chains[sel_col.first])).split('.').last
614
+ v1.map { |x| [x[0..-2].map(&:to_s).join('.'), x.last] }.each_with_index do |sel_col, idx|
615
+ field_tbl_name = rel_dupe.brick_links[sel_col.first].split('.').last
592
616
  # If it's Oracle, quote any AREL aliases that had been applied
593
617
  field_tbl_name = "\"#{field_tbl_name}\"" if ::Brick.is_oracle && rel_dupe._arel_applied_aliases.include?(field_tbl_name)
594
618
 
595
619
  # Postgres can not use DISTINCT with any columns that are XML, so for any of those just convert to text
596
- is_xml = is_distinct && Brick.relations[sel_col.first.table_name]&.[](:cols)&.[](sel_col.last)&.first&.start_with?('xml')
620
+ is_xml = is_distinct && Brick.relations[field_tbl_name]&.[](:cols)&.[](sel_col.last)&.first&.start_with?('xml')
597
621
  # If it's not unique then also include the belongs_to association name before the column name
598
622
  if used_col_aliases.key?(col_alias = "br_fk_#{v.first}__#{sel_col.last}")
599
623
  col_alias = "br_fk_#{v.first}__#{v1[idx][-2..-1].map(&:to_s).join('__')}"
@@ -630,14 +654,9 @@ module ActiveRecord
630
654
  end
631
655
  end
632
656
  join_array.each do |assoc_name|
633
- # %%% Need to support {user: :profile}
634
657
  next unless assoc_name.is_a?(Symbol)
635
658
 
636
- table_alias = if (chain = chains[klass = reflect_on_association(assoc_name)&.klass])
637
- shift_or_first(chain)
638
- else
639
- klass.table_name # ActiveRecord < 4.2 can't (yet) use the cool chains thing
640
- end
659
+ table_alias = rel_dupe.brick_links[assoc_name.to_s]
641
660
  _assoc_names[assoc_name] = [table_alias, klass]
642
661
  end
643
662
  end
@@ -648,26 +667,47 @@ module ActiveRecord
648
667
  # Build the chain of JOINs going to the final destination HMT table
649
668
  # (Usually just one JOIN, but could be many.)
650
669
  hmt_assoc = hm
651
- x = []
652
- x.unshift(hmt_assoc) while hmt_assoc.options[:through] && (hmt_assoc = klass.reflect_on_association(hmt_assoc.options[:through]))
653
- from_clause = +"#{x.first.table_name} br_t0"
654
- fk_col = x.shift.foreign_key
655
- link_back = [klass.primary_key] # %%% Inverse path back to the original object -- used to build out a link with a filter
670
+ through_sources = []
671
+ # %%% Inverse path back to the original object -- not yet used, but soon
672
+ # will be leveraged in order to build links with multi-table-hop filters.
673
+ link_back = []
674
+ # Track polymorphic type field if necessary
675
+ if hm.source_reflection.options[:as]
676
+ poly_ft = [hm.source_reflection.inverse_of.foreign_type, hmt_assoc.source_reflection.class_name]
677
+ end
678
+ # link_back << hm.source_reflection.inverse_of.name
679
+ while hmt_assoc.options[:through] && (hmt_assoc = klass.reflect_on_association(hmt_assoc.options[:through]))
680
+ through_sources.unshift(hmt_assoc)
681
+ end
682
+ # Turn the last member of link_back into a foreign key
683
+ link_back << hmt_assoc.source_reflection.foreign_key
684
+ # If it's a HMT based on a HM -> HM, must JOIN the last table into the mix at the end
685
+ through_sources.push(hm.source_reflection) unless hm.source_reflection.belongs_to?
686
+ from_clause = +"#{through_sources.first.table_name} br_t0"
687
+ fk_col = through_sources.shift.foreign_key
688
+
656
689
  idx = 0
657
690
  bail_out = nil
658
- x.map do |a|
691
+ through_sources.map do |a|
659
692
  from_clause << "\n LEFT OUTER JOIN #{a.table_name} br_t#{idx += 1} "
660
693
  from_clause << if (src_ref = a.source_reflection).macro == :belongs_to
694
+ (nm = hmt_assoc.source_reflection.inverse_of&.name)
695
+ # binding.pry unless nm
696
+ link_back << nm
661
697
  "ON br_t#{idx}.id = br_t#{idx - 1}.#{a.foreign_key}"
662
698
  elsif src_ref.options[:as]
663
699
  "ON br_t#{idx}.#{src_ref.type} = '#{src_ref.active_record.name}'" + # "polymorphable_type"
664
700
  " AND br_t#{idx}.#{src_ref.foreign_key} = br_t#{idx - 1}.id"
665
701
  elsif src_ref.options[:source_type]
666
- print "Skipping #{hm.name} --HMT-> #{hm.source_reflection.name} as it uses source_type which is not supported"
702
+ print "Skipping #{hm.name} --HMT-> #{hm.source_reflection.name} as it uses source_type which is not yet supported"
667
703
  nix << k
668
704
  bail_out = true
669
705
  break
670
706
  else # Standard has_many
707
+ # binding.pry unless (
708
+ nm = hmt_assoc.source_reflection.inverse_of&.name
709
+ # )
710
+ link_back << nm # if nm
671
711
  "ON br_t#{idx}.#{a.foreign_key} = br_t#{idx - 1}.id"
672
712
  end
673
713
  link_back.unshift(a.source_reflection.name)
@@ -675,6 +715,7 @@ module ActiveRecord
675
715
  end
676
716
  next if bail_out
677
717
 
718
+ # puts "LINK BACK! #{k} : #{hm.table_name} #{link_back.map(&:to_s).join('.')}"
678
719
  # count_column is determined from the originating HMT member
679
720
  if (src_ref = hm.source_reflection).nil?
680
721
  puts "*** Warning: Could not determine destination model for this HMT association in model #{klass.name}:\n has_many :#{hm.name}, through: :#{hm.options[:through]}"
@@ -682,8 +723,10 @@ module ActiveRecord
682
723
  nix << k
683
724
  next
684
725
  elsif src_ref.macro == :belongs_to # Traditional HMT using an associative table
726
+ # binding.pry if link_back.length > 2
685
727
  "br_t#{idx}.#{hm.foreign_key}"
686
728
  else # A HMT that goes HM -> HM, something like Categories -> Products -> LineItems
729
+ # binding.pry if link_back.length > 2
687
730
  "br_t#{idx}.#{src_ref.active_record.primary_key}"
688
731
  end
689
732
  else
@@ -747,8 +790,7 @@ JOIN (SELECT #{hm_selects.map { |s| "#{'br_t0.' if from_clause}#{s}" }.join(', '
747
790
  if (v_parts = v.first.split('.')).length == 1
748
791
  s[v.first] = v.last
749
792
  else
750
- k1 = klass.reflect_on_association(v_parts.first)&.klass
751
- tbl_name = (field_tbl_names[v_parts.first][k1] ||= shift_or_first(chains[k1])).split('.').last
793
+ tbl_name = rel_dupe.brick_links[v_parts.first].split('.').last
752
794
  s["#{tbl_name}.#{v_parts.last}"] = v.last
753
795
  end
754
796
  end
@@ -1167,7 +1209,7 @@ class Object
1167
1209
  if (base_model = ::Brick.sti_models[full_model_name]&.fetch(:base, nil) || ::Brick.existing_stis[full_model_name]&.constantize)
1168
1210
  is_sti = true
1169
1211
  else
1170
- base_model = ::Brick.config.models_inherit_from || ActiveRecord::Base
1212
+ base_model = ::Brick.config.models_inherit_from
1171
1213
  end
1172
1214
  hmts = nil
1173
1215
  code = +"class #{full_name} < #{base_model.name}\n"
@@ -19,7 +19,12 @@ module Brick
19
19
  ::Brick.exclude_tables = app.config.brick.fetch(:exclude_tables, [])
20
20
 
21
21
  # Class for auto-generated models to inherit from
22
- ::Brick.models_inherit_from = app.config.brick.fetch(:models_inherit_from, ActiveRecord::Base)
22
+ ::Brick.models_inherit_from = app.config.brick.fetch(:models_inherit_from, nil) ||
23
+ begin
24
+ ::ApplicationRecord
25
+ rescue StandardError => ex
26
+ ::ActiveRecord::Base
27
+ end
23
28
 
24
29
  # When table names have specific prefixes, automatically place them in their own module with a table_name_prefix.
25
30
  ::Brick.table_name_prefixes = app.config.brick.fetch(:table_name_prefixes, [])
@@ -985,7 +990,12 @@ erDiagram
985
990
  %><%= display_value(col_type || col&.sql_type, val) %><%
986
991
  elsif cust_col
987
992
  data = cust_col.first.map { |cc_part| #{obj_name}.send(cc_part.last) }
988
- %><%= #{model_name}.brick_descrip(cust_col.last, data) %><%
993
+ cust_txt = #{model_name}.brick_descrip(cust_col[-2], data)
994
+ if (link_id = #{obj_name}.send(cust_col.last[1]) if cust_col.last)
995
+ %><%= link_to(cust_txt, send(\"#\{cust_col.last.first._brick_index(:singular)}_path\", link_id)) %><%
996
+ else
997
+ %><%= cust_txt %><%
998
+ end
989
999
  else # Bad column name!
990
1000
  %>?<%
991
1001
  end
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 90
8
+ TINY = 92
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
@@ -1052,6 +1052,40 @@ ActiveSupport.on_load(:active_record) do
1052
1052
  end
1053
1053
  end
1054
1054
 
1055
+ class ActiveRecord::Associations::JoinDependency
1056
+ if JoinBase.instance_method(:initialize).arity == 2 # Older ActiveRecord 4.x?
1057
+ def initialize(base, associations, joins)
1058
+ @alias_tracker = ::ActiveRecord::Associations::AliasTracker.create(base.connection, joins)
1059
+ @alias_tracker.aliased_table_for(base.table_name, base.table_name) # Updates the count for base.table_name to 1
1060
+ tree = self.class.make_tree associations
1061
+
1062
+ # Provide a way to find the original relation that this tree is being used for
1063
+ # (so that we can maintain a list of links for all tables used in JOINs)
1064
+ if (relation = associations.instance_variable_get(:@relation))
1065
+ tree.instance_variable_set(:@relation, relation)
1066
+ end
1067
+
1068
+ @join_root = JoinBase.new base, build(tree, base)
1069
+ @join_root.children.each { |child| construct_tables! @join_root, child }
1070
+ end
1071
+
1072
+ else # For ActiveRecord 5.0 - 7.1
1073
+
1074
+ def initialize(base, table, associations, join_type = nil)
1075
+ tree = self.class.make_tree associations
1076
+
1077
+ # Provide a way to find the original relation that this tree is being used for
1078
+ # (so that we can maintain a list of links for all tables used in JOINs)
1079
+ if (relation = associations.instance_variable_get(:@relation))
1080
+ tree.instance_variable_set(:@relation, relation)
1081
+ end
1082
+
1083
+ @join_root = JoinBase.new(base, table, build(tree, base))
1084
+ @join_type = join_type if join_type
1085
+ end
1086
+ end
1087
+ end
1088
+
1055
1089
  # First part of arel_table_type stuff:
1056
1090
  # ------------------------------------
1057
1091
  # (more found below)
@@ -1178,7 +1212,7 @@ if ActiveRecord.version < ::Gem::Version.new('5.2')
1178
1212
 
1179
1213
  module Associations
1180
1214
  # Specific to AR 4.2 - 5.1:
1181
- if Associations.const_defined?('JoinDependency') && JoinDependency.private_instance_methods.include?(:table_aliases_for)
1215
+ if self.const_defined?('JoinDependency') && JoinDependency.private_instance_methods.include?(:table_aliases_for)
1182
1216
  class JoinDependency
1183
1217
  private
1184
1218
 
@@ -1230,4 +1264,91 @@ if ActiveRecord.version < ::Gem::Version.new('5.2')
1230
1264
  # rubocop:enable Style/CommentedKeyword
1231
1265
  end
1232
1266
 
1267
+ module ActiveRecord
1268
+ module QueryMethods
1269
+ private
1270
+
1271
+ if private_instance_methods.include?(:build_join_query)
1272
+ alias _brick_build_join_query build_join_query
1273
+ def build_join_query(manager, buckets, *args)
1274
+ # %%% Better way to bring relation into the mix
1275
+ if (aj = buckets.fetch(:association_join, nil))
1276
+ aj.instance_variable_set(:@relation, self)
1277
+ end
1278
+
1279
+ _brick_build_join_query(manager, buckets, *args)
1280
+ end
1281
+
1282
+ else
1283
+
1284
+ alias _brick_select_association_list select_association_list
1285
+ def select_association_list(associations, stashed_joins = nil)
1286
+ result = _brick_select_association_list(associations, stashed_joins)
1287
+ result.instance_variable_set(:@relation, self)
1288
+ result
1289
+ end
1290
+ end
1291
+ end
1292
+
1293
+ # require 'activerecord/associations/join_dependency'
1294
+ module Associations
1295
+ # For AR >= 4.2
1296
+ if self.const_defined?('JoinDependency')
1297
+ class JoinDependency
1298
+ private
1299
+
1300
+ # %%% Pretty much have to flat-out replace this guy (I think anyway)
1301
+ # Good with Rails 5.24 and 7 on this
1302
+ def build(associations, base_klass, root = nil, path = '')
1303
+ root ||= associations
1304
+ associations.map do |name, right|
1305
+ reflection = find_reflection base_klass, name
1306
+ reflection.check_validity!
1307
+ reflection.check_eager_loadable!
1308
+
1309
+ if reflection.polymorphic?
1310
+ raise EagerLoadPolymorphicError.new(reflection)
1311
+ end
1312
+
1313
+ # %%% The path
1314
+ link_path = path.blank? ? name.to_s : path + ".#{name}"
1315
+ ja = JoinAssociation.new(reflection, build(right, reflection.klass, root, link_path))
1316
+ ja.instance_variable_set(:@link_path, link_path) # Make note on the JoinAssociation of its AR path
1317
+ ja.instance_variable_set(:@assocs, root)
1318
+ ja
1319
+ end
1320
+ end
1321
+
1322
+ if JoinDependency.private_instance_methods.include?(:table_aliases_for)
1323
+ # No matter if it's older or newer Rails, now extend so that we can associate AR links to table_alias names
1324
+ alias _brick_table_aliases_for table_aliases_for
1325
+ def table_aliases_for(parent, node)
1326
+ result = _brick_table_aliases_for(parent, node)
1327
+
1328
+ # Capture the table alias name that was chosen
1329
+ link_path = node.instance_variable_get(:@link_path)
1330
+ if (relation = node.instance_variable_get(:@assocs)&.instance_variable_get(:@relation))
1331
+ relation.brick_links[link_path] = result.first.table_alias || result.first.table_name
1332
+ end
1333
+
1334
+ result
1335
+ end
1336
+ else # Same idea but for Rails 7
1337
+ alias _brick_make_constraints make_constraints
1338
+ def make_constraints(parent, child, join_type)
1339
+ result = _brick_make_constraints(parent, child, join_type)
1340
+
1341
+ # Capture the table alias name that was chosen
1342
+ link_path = child.instance_variable_get(:@link_path)
1343
+ relation = child.instance_variable_get(:@assocs)&.instance_variable_get(:@relation)
1344
+ # binding.pry if relation
1345
+ relation.brick_links[link_path] = result.first.left.table_alias || result.first.left.table_name
1346
+ result
1347
+ end
1348
+ end
1349
+ end
1350
+ end
1351
+ end
1352
+ end
1353
+
1233
1354
  require 'brick/extensions'
@@ -139,7 +139,7 @@ module Brick
139
139
  # Settings for the Brick gem
140
140
  # (By default this auto-creates models, controllers, views, and routes on-the-fly.)
141
141
 
142
- if Object.const_defined?('Brick')
142
+ if ActiveRecord::Base.respond_to?(:brick_select)
143
143
  # Mode -- generally :on or :off, or only in :development. Also available is :diag_env which enables only
144
144
  # when the environment variable BRICK is set.
145
145
  Brick.mode = :development
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.90
4
+ version: 1.0.92
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-04 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord