brick 1.0.88 → 1.0.89
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/frameworks/rails/engine.rb +10 -2
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +3 -3
- 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: a94d71d50a84c847db5f2c34e5aba600502ecb60d4dc7752dc65ac21f4ffe41b
|
4
|
+
data.tar.gz: 6f337f6220cf5989669497e85da0d4620861b1be6e4a35720a072698d866ebe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 703fa83ad63f9da5f4431c05db9fee57843419b62283f92f39b7b4cf9397848177f10f57af7fc03f08cf503a392676adac272a04fe4ae6becbf0e0a5eb62c550
|
7
|
+
data.tar.gz: 686c752bd2ed92de4f12c4afe27389d8a6cced25b47c5a18564c5afdf51199bd148f66ec5636ee8094a0cda5ae1ccafce31bc532a9d7d6a64c4cc968013f6af3
|
@@ -1201,7 +1201,8 @@ end
|
|
1201
1201
|
<% end %>
|
1202
1202
|
|
1203
1203
|
#{unless args.first == 'new'
|
1204
|
-
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?' } }"
|
1204
|
+
# 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?' } }"
|
1205
|
+
confirm_are_you_sure = "data: { confirm: 'Delete #{model_name} -- Are you sure?' }"
|
1205
1206
|
hms_headers.each_with_object(+'') do |hm, s|
|
1206
1207
|
# %%% Would be able to remove this when multiple foreign keys to same destination becomes bulletproof
|
1207
1208
|
next if hm.first.options[:through] && !hm.first.through_reflection
|
@@ -1212,7 +1213,14 @@ end
|
|
1212
1213
|
s << "<table id=\"#{hm_name}\" class=\"shadow\">
|
1213
1214
|
<tr><th>#{hm[3]}</th></tr>
|
1214
1215
|
<% collection = @#{obj_name}.#{hm_name}
|
1215
|
-
collection =
|
1216
|
+
collection = case collection
|
1217
|
+
when ActiveRecord::Associations::CollectionProxy
|
1218
|
+
collection.order(#{pk.inspect})
|
1219
|
+
when ActiveRecord::Base # Object from a has_one
|
1220
|
+
[collection]
|
1221
|
+
else # We get an array back when AR < 4.2
|
1222
|
+
collection.to_a.compact
|
1223
|
+
end
|
1216
1224
|
if collection.empty? %>
|
1217
1225
|
<tr><td>(none)</td></tr>
|
1218
1226
|
<% else %>
|
data/lib/brick/version_number.rb
CHANGED
data/lib/brick.rb
CHANGED
@@ -186,7 +186,7 @@ module Brick
|
|
186
186
|
|
187
187
|
def get_bts_and_hms(model)
|
188
188
|
bts, hms = model.reflect_on_all_associations.each_with_object([{}, {}]) do |a, s|
|
189
|
-
next if !
|
189
|
+
next if !a.polymorphic? && (a.klass.nil? || ::Brick.config.exclude_tables.include?(a.klass.table_name))
|
190
190
|
|
191
191
|
case a.macro
|
192
192
|
when :belongs_to
|
@@ -194,7 +194,7 @@ module Brick
|
|
194
194
|
rel_poly_bt = relations[model.table_name][:fks].find { |_k, fk| fk[:assoc_name] == a.name.to_s }
|
195
195
|
if (primary_tables = rel_poly_bt&.last&.fetch(:inverse_table, [])).is_a?(Array)
|
196
196
|
models = primary_tables&.map { |table| table.singularize.camelize.constantize }
|
197
|
-
s.first[a.foreign_key] = [a.name, models, true]
|
197
|
+
s.first[a.foreign_key.to_s] = [a.name, models, true]
|
198
198
|
else
|
199
199
|
# This will come up when using Devise invitable when invited_by_class_name is not
|
200
200
|
# specified because in that circumstance it adds a polymorphic :invited_by association,
|
@@ -203,7 +203,7 @@ module Brick
|
|
203
203
|
puts " belongs_to :#{a.name}, polymorphic: true"
|
204
204
|
end
|
205
205
|
else
|
206
|
-
s.first[a.foreign_key] = [a.name, a.klass]
|
206
|
+
s.first[a.foreign_key.to_s] = [a.name, a.klass]
|
207
207
|
end
|
208
208
|
when :has_many, :has_one # This gets has_many as well as has_many :through
|
209
209
|
# %%% weed out ones that don't have an available model to reference
|
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.89
|
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-
|
11
|
+
date: 2022-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|