brick 1.0.240 → 1.0.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9305066dea63f3492fab7147dd3ae0ce1b6e3b12a444a66bbf4dfd164c4d024
4
- data.tar.gz: bc5ad1f8ddbae015ccb3954cd632f7fe7ca50e3349575e7b7995dd74b4339939
3
+ metadata.gz: 1e28a33c378751e44778744e81bd2841b6bdd61d06587860b2a5f9bccccbaa85
4
+ data.tar.gz: 13f3272c5f8eabac2fb7c9253a1ce499fd2dd208d468b048e60c2542f3456eb9
5
5
  SHA512:
6
- metadata.gz: ff606a5af0257fac32914e1891a0977d770866394396ccbcf1993b0898bedad4612f18bc00fdb45da175cd9a9aee28304b51d920d5a6d574e9be5c09db4e970f
7
- data.tar.gz: c253b9d7976a25d9bd4beab9b8cc3eb1bf18d3238139af6763d14c3de40641ec1538337b8896eb6717cb5a41f2dc02c97cbcbcce1098e401d6eae86ccc73623f
6
+ metadata.gz: b7f7c82a56a1097cd710a27f229988949e2327f9de6539302acd05a15ceea61d01b2960d98e9708fa823c24022509258ef2879b41c700822f1d8769c5734792a
7
+ data.tar.gz: 679dc5f6151313ef1d7bcd9912cbe4770741c5d03a7c3a29a1d139e72f96cdf778d096fffbf2018c80b8148a91310127a184072d0a63f07905c67c157a9d3e55
@@ -661,6 +661,8 @@ module ActiveRecord
661
661
 
662
662
  is_distinct = nil
663
663
  wheres = {}
664
+ params = params.to_unsafe_h unless params.is_a?(Hash)
665
+ params.merge!(args[1]) if args[1]
664
666
  params.each do |k, v|
665
667
  k = k.to_s # Rails < 4.2 comes in as a symbol
666
668
  next unless k.start_with?('__')
@@ -1048,7 +1050,7 @@ JOIN (SELECT #{hm_selects.map { |s| _br_quoted_name("#{'br_t0.' if from_clause}#
1048
1050
  [brick_links[v_parts[0..-2].join('.')].split('.').last]
1049
1051
  end
1050
1052
  tbl_and_col_name << v_parts.last
1051
- if ['>', '<'].include?(first_char = v.last.first[0]) # Greater than or less than?
1053
+ if v.last.is_a?(String) && ['>', '<'].include?(first_char = v.last.first[0]) # Greater than or less than?
1052
1054
  col_name = v.last.first[1..-1]
1053
1055
  col_name = "'#{col_name}'" unless [:integer, :boolean, :decimal, :float].include?(klass.columns_hash[v.first].type)
1054
1056
  where_comparisons << "#{tbl_and_col_name.join('.')} #{first_char} #{col_name}"
@@ -1120,7 +1122,7 @@ JOIN (SELECT #{hm_selects.map { |s| _br_quoted_name("#{'br_t0.' if from_clause}#
1120
1122
  end
1121
1123
 
1122
1124
  # Build out an AR relation that queries for a list of objects, and include all the appropriate JOINs to later apply DSL using #brick_descrip
1123
- def brick_list
1125
+ def brick_list(wheres = nil)
1124
1126
  selects = klass._pk_as_array.each_with_object([]) { |pk, s| s << pk unless s.include?(pk) }
1125
1127
  # Get foreign keys for anything marked to be auto-preloaded, or a self-referencing JOIN
1126
1128
  klass_cols = klass.column_names
@@ -1139,6 +1141,9 @@ JOIN (SELECT #{hm_selects.map { |s| _br_quoted_name("#{'br_t0.' if from_clause}#
1139
1141
  selects << 'customer_id' if klass.name == 'Pay::Subscription' && Pay::Subscription.columns_hash.key?('customer_id')
1140
1142
 
1141
1143
  pieces, my_dsl = klass.brick_parse_dsl(join_array = ::Brick::JoinArray.new, [], translations = {}, false, nil, true)
1144
+ if wheres
1145
+ where_values_hash = (where_values_hash || {}).merge(wheres)
1146
+ end
1142
1147
  _brick_querying(
1143
1148
  selects, where_values_hash, nil, translations: translations, join_array: join_array,
1144
1149
  cust_col_override: { '_br' => (descrip_cols = [pieces, my_dsl]) },
@@ -1803,8 +1808,8 @@ class Object
1803
1808
  # No primary key, but is there anything UNIQUE?
1804
1809
  # (Sort so that if there are multiple UNIQUE constraints we'll pick one that uses the least number of columns.)
1805
1810
  our_pks = relation[:ukeys].values.sort { |a, b| a.length <=> b.length }.first unless our_pks&.present?
1806
- if has_pk
1807
- code << " # Primary key: #{_brick_primary_key.join(', ')}\n" unless _brick_primary_key == ['id']
1811
+ if has_pk && _brick_primary_key != ['id']
1812
+ code << " # Primary key: #{_brick_primary_key.join(', ')}\n"
1808
1813
  elsif our_pks&.present?
1809
1814
  pk_mutator = if respond_to?(:'primary_keys=')
1810
1815
  'primary_keys=' # Using the composite_primary_keys gem
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 240
8
+ TINY = 242
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
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.240
4
+ version: 1.0.242
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-27 00:00:00.000000000 Z
11
+ date: 2025-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord