brick 1.0.196 → 1.0.197

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: 9f5cff29063c150d35653274752bcda0ed44ce462563824f8b8a974dfacc8a81
4
- data.tar.gz: 2d26e1e8a62b3a9e69c6a28a37e640fa5c5e0ced28a6527db4b68d2abdfc47f5
3
+ metadata.gz: bfd8798f339e1bb363ca73f7b3285cdb32471cbae2c6ff5a500b43db6536840a
4
+ data.tar.gz: be5744fd98d6323ecb33be2b77f50e9ee5b872bc8356ef4d08372cddab4d9920
5
5
  SHA512:
6
- metadata.gz: 150e669bb088db49139311839cbca472317b371d24ab85bc096bea94221331c1f7122b8ed521a9c87691d9ded450d723954c2bd7d833b56fd07f248be5624339
7
- data.tar.gz: cf000d92773ce9ec8db6a412e7f4fe642e6e9bc07db9412459931a69ebc7dff7fb41de9d1824d068b9c8568827cdbd1881073f3404b85eab1fc1c5670cd625ff
6
+ metadata.gz: 8848e2c6a93a75f454b0b9ebd4712769c39868583fc6d6659548c6eb3818eec12bfb7968580a4c684eab67095fca754553a42bc4b71729b223f79882731ebfd3
7
+ data.tar.gz: b764da2f667e22e5d02e6f5354e3b4b30164827c5b40647b7fca672038f7435ebe14f32dc22d05c54375a29e94c68d82b61dc590099f9e26f2b4843092861bed
@@ -3468,9 +3468,9 @@ module Brick
3468
3468
  separator ||= '_'
3469
3469
  res_name = (tbl_name_parts = tbl_name.split('.'))[0..-2].first
3470
3470
  res_name << '.' if res_name
3471
- (res_name ||= +'') << (relation || ::Brick.relations.fetch(tbl_name, nil))&.fetch(:resource, nil) || tbl_name_parts.last
3471
+ (res_name ||= +'') << (relation ||= ::Brick.relations.fetch(tbl_name, nil))&.fetch(:resource, nil) || tbl_name_parts.last
3472
3472
 
3473
- res_parts = ((mode == :singular) ? res_name.singularize : res_name).split('.')
3473
+ res_parts = ((mode == :singular) ? tbl_name.singularize : tbl_name).split('.')
3474
3474
  res_parts.shift if ::Brick.apartment_multitenant && res_parts.length > 1 && res_parts.first == ::Brick.apartment_default_tenant
3475
3475
  if (aps = relation&.fetch(:auto_prefixed_schema, nil)) && res_parts.last.start_with?(aps)
3476
3476
  last_part = res_parts.last[aps.length..-1]
@@ -3487,7 +3487,7 @@ module Brick
3487
3487
  index = index.tr('_', 'x') if separator == 'x'
3488
3488
  # Rails applies an _index suffix to that route when the resource name isn't something plural
3489
3489
  index << '_index' if mode != :singular && separator == '_' &&
3490
- index == (path_prefix + [name&.underscore&.tr('/', '_') || '_']).join(separator)
3490
+ index == (path_prefix + [relation[:class_name]&.underscore&.tr('/', '_') || '_']).join(separator)
3491
3491
  index
3492
3492
  end
3493
3493
 
@@ -74,7 +74,7 @@ module Brick
74
74
  schema_prefix = "#{schema_name}."
75
75
  end
76
76
 
77
- resource_name = v.fetch(:resource, nil)
77
+ resource_name = v.fetch(:resource, nil) || k
78
78
  next if !resource_name ||
79
79
  existing_controllers.key?(
80
80
  controller_prefix + (resource_name = "#{schema_prefix&.tr('.', '/')}#{resource_name}".pluralize)
@@ -82,7 +82,7 @@ module Brick
82
82
 
83
83
  object_name = k.split('.').last # Take off any first schema part
84
84
 
85
- full_schema_prefix = if (full_aps = aps = v.fetch(:auto_prefixed_schema, nil))
85
+ full_schema_prefix = if (aps = v.fetch(:auto_prefixed_schema, nil))
86
86
  aps = aps[0..-2] if aps[-1] == '_'
87
87
  (schema_prefix&.dup || +'') << "#{aps}."
88
88
  else
@@ -90,7 +90,6 @@ module Brick
90
90
  end
91
91
 
92
92
  # Track routes being built
93
- resource_name = v.fetch(:resource, nil) || k
94
93
  if (class_name = v.fetch(:class_name, nil))
95
94
  if v.key?(:isView)
96
95
  view_class_length = class_name.length if class_name.length > view_class_length
@@ -98,7 +97,7 @@ module Brick
98
97
  else
99
98
  table_class_length = class_name.length if class_name.length > table_class_length
100
99
  tables
101
- end << [class_name, aps, "#{"#{schema_name}/" if schema_name}#{resource_name[full_aps&.length || 0 .. -1]}"]
100
+ end << [class_name, aps, "#{"#{schema_name}/" if schema_name}#{resource_name}"]
102
101
  end
103
102
 
104
103
  options = {}
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 196
8
+ TINY = 197
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.196
4
+ version: 1.0.197
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-12-30 00:00:00.000000000 Z
11
+ date: 2024-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord