brick 1.0.170 → 1.0.171
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 +5 -5
- data/lib/brick/frameworks/rails/engine.rb +2 -2
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3632cff341398d0856d985613943d45da5a4de86797c1c59f0e38e31218e8e3d
|
|
4
|
+
data.tar.gz: cd8374ed7f930d8eb17fa12b7947a00d973571dc493f7ecc677350d8be0cfe75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66814142c86e8066bb0a72aba93df3a0a826b9ca48cd14dd547291e27079399ed344e41c547dbd4c5fd26d98f7d361e9ad73c7a3bb53e96ec165c1b1b87a478a
|
|
7
|
+
data.tar.gz: e17de43008cd2b7e1a8ed62aad8cc428248f145e024266e7f4237f892d844d08a6cdc238c650c46986a9f1a1038d87cc7bd16531ad532bc25f2e6f7bc1a2af9b
|
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) &&
|
|
@@ -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
|