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 +4 -4
- data/lib/brick/extensions.rb +9 -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: 1e28a33c378751e44778744e81bd2841b6bdd61d06587860b2a5f9bccccbaa85
|
4
|
+
data.tar.gz: 13f3272c5f8eabac2fb7c9253a1ce499fd2dd208d468b048e60c2542f3456eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7f7c82a56a1097cd710a27f229988949e2327f9de6539302acd05a15ceea61d01b2960d98e9708fa823c24022509258ef2879b41c700822f1d8769c5734792a
|
7
|
+
data.tar.gz: 679dc5f6151313ef1d7bcd9912cbe4770741c5d03a7c3a29a1d139e72f96cdf778d096fffbf2018c80b8148a91310127a184072d0a63f07905c67c157a9d3e55
|
data/lib/brick/extensions.rb
CHANGED
@@ -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"
|
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
|
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.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-
|
11
|
+
date: 2025-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|