brick 1.0.170 → 1.0.172
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/extensions.rb +6 -6
- data/lib/brick/frameworks/rails/engine.rb +2 -2
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +2 -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: 8a38be99462ba1e409c48be433e3ab289b971872c6a3988e28159f52cfdc4645
|
4
|
+
data.tar.gz: 4af53a2029649d13b978f9ab263ce2ead02818afd807751621cf6fd38ac1b7dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9890e01ab3124bf1256f094569abd92c92712d440df8f3ccf9f06cf6ec57fb29bf4afa3e7acc7344253330ae80cbb17983aa4b6b508f2748b13b8926553dadd1
|
7
|
+
data.tar.gz: 280c4a94f788fe459f83ea18fa858152020d952eadb0bc5cd9aee645e03faf65d3dca5edd045328366d7f67a62879341043657396c6bf35ab0e282850cd889fe
|
data/lib/brick/extensions.rb
CHANGED
@@ -1676,7 +1676,7 @@ class Object
|
|
1676
1676
|
# options[:source] = other.first[:inverse][:assoc_name].to_sym
|
1677
1677
|
# And also has been:
|
1678
1678
|
# hm.first[:inverse][:assoc_name].to_sym
|
1679
|
-
options[:source] = hm.
|
1679
|
+
options[:source] = hm[1].to_sym
|
1680
1680
|
else
|
1681
1681
|
through = hm.first.fetch(:alternate_chosen_name, hm.first[:alternate_name])
|
1682
1682
|
end
|
@@ -1692,11 +1692,11 @@ class Object
|
|
1692
1692
|
# Was:
|
1693
1693
|
# options[:class_name] = hm.first[:inverse_table].singularize.camelize
|
1694
1694
|
# options[:foreign_key] = hm.first[:fk].to_sym
|
1695
|
-
far_assoc = relations[hm.first[:inverse_table]][:fks].find { |_k, v| v[:assoc_name] == hm
|
1695
|
+
far_assoc = relations[hm.first[:inverse_table]][:fks].find { |_k, v| v[:assoc_name] == hm[1] }
|
1696
1696
|
options[:class_name] = far_assoc.last[:inverse_table].singularize.camelize
|
1697
1697
|
options[:foreign_key] = far_assoc.last[:fk].to_sym
|
1698
1698
|
end
|
1699
|
-
options[:source] ||= hm.
|
1699
|
+
options[:source] ||= hm[1].to_sym unless hmt_name.singularize == hm[1]
|
1700
1700
|
code << " has_many :#{hmt_name}#{options.map { |opt| ", #{opt.first}: #{opt.last.inspect}" }.join}\n"
|
1701
1701
|
new_model_class.send(:has_many, hmt_name.to_sym, **options)
|
1702
1702
|
end
|
@@ -1805,11 +1805,11 @@ class Object
|
|
1805
1805
|
end
|
1806
1806
|
|
1807
1807
|
# Add any relevant user-requested HMTs
|
1808
|
-
Brick.config.hmts
|
1808
|
+
Brick.config.hmts&.each do |hmt|
|
1809
1809
|
# Make sure this HMT lines up with the current HM
|
1810
1810
|
next unless hmt.first == table_name && hmt[1] == inverse_table &&
|
1811
1811
|
# And has not already been auto-created
|
1812
|
-
!(
|
1812
|
+
!(hmts.fetch(hmt[2], nil)&.any? { |existing_hmt| existing_hmt.first[:assoc_name] == hmt[1] })
|
1813
1813
|
|
1814
1814
|
# Good so far -- now see if we have appropriate HM -> BT/HM associations by which we can create this user-requested HMT
|
1815
1815
|
if (hm_assoc = relation[:fks].find { |_k, v| !v[:is_bt] && v[:assoc_name] == hmt[1] }.last) &&
|
@@ -1885,7 +1885,7 @@ class Object
|
|
1885
1885
|
cspd.select! { |val| val == "'self'" }
|
1886
1886
|
cspd << style_value
|
1887
1887
|
else
|
1888
|
-
cspd << "'sha256-
|
1888
|
+
cspd << "'sha256-W2ts9oOhJ+mkUTLCn4yS7VZSGkeqfdUogX8MEjE0TSw='"
|
1889
1889
|
end
|
1890
1890
|
cspd << 'https://cdn.jsdelivr.net'
|
1891
1891
|
end
|
@@ -1669,8 +1669,8 @@ end
|
|
1669
1669
|
brick_form_for(obj, options, #{model_name}, bts, #{pk.inspect}) %>
|
1670
1670
|
|
1671
1671
|
#{unless args.first == 'new'
|
1672
|
-
# Was: confirm_are_you_sure = ActionView.version < ::Gem::Version.new('7.0') ? "data: { confirm:
|
1673
|
-
confirm_are_you_sure = "data: { confirm:
|
1672
|
+
# Was: confirm_are_you_sure = ActionView.version < ::Gem::Version.new('7.0') ? "data: { confirm: \"Delete #\{model_name} -- Are you sure?\" }" : "form: { data: { turbo_confirm: \"Delete #\{model_name} -- Are you sure?\" } }"
|
1673
|
+
confirm_are_you_sure = "data: { confirm: \"Delete #\{model_name} -- Are you sure?\" }"
|
1674
1674
|
ret = +"<%= button_to(\"Delete #\{@#{obj_name}.brick_descrip}\", send(\"#\{#{model_name}._brick_index(:singular)}_path\".to_sym, @#{obj_name}), { method: 'delete', class: 'danger', #{confirm_are_you_sure} }) %>"
|
1675
1675
|
hms_headers.each_with_object(ret) do |hm, s|
|
1676
1676
|
# %%% Would be able to remove this when multiple foreign keys to same destination becomes bulletproof
|
data/lib/brick/version_number.rb
CHANGED
data/lib/brick.rb
CHANGED
@@ -278,7 +278,8 @@ module Brick
|
|
278
278
|
if (through = hmt.last.options[:through])
|
279
279
|
# ::Brick.relations[hmt.last.through_reflection.table_name]
|
280
280
|
skip_hms[through] = nil if hms[through] && model.is_brick? &&
|
281
|
-
hmt.last.klass != hmt.last.active_record # Don't pull HMs for HMTs that point back to the same table
|
281
|
+
hmt.last.klass != hmt.last.active_record && # Don't pull HMs for HMTs that point back to the same table
|
282
|
+
hmt[1].source_reflection.belongs_to? # Don't pull HMs when the HMT is built from HM -> HM
|
282
283
|
# End up with a hash of HMT names pointing to join-table associations
|
283
284
|
model._br_associatives[hmt.first] = hms[through] # || hms["#{(opt = hmt.last.options)[:through].to_s.singularize}_#{opt[:source].to_s.pluralize}".to_sym]
|
284
285
|
end
|
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.172
|
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-
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|