bullet_train-super_scaffolding 1.6.8 → 1.6.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb72d4e418e35117006cbc2bde82d94fa388771c2eec71444abcf51d793f985
|
4
|
+
data.tar.gz: 63d86d99b7520dfb506c2d78608fbf2bf4448ef40c89123006c5dd45c4240fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc8a4ba76d763ad6167e20c742a357376e54a0de4a9f9e345891c29435dbac3ac506be1d7da29920d872c44a9accec0de9d76b9d50732e6f607d398b3ddb076c
|
7
|
+
data.tar.gz: cafb5f4eb58dc6e1f074302ef885fccb313459b56998f360621822212d48cf18c5eabd67db694baee157261d9921859a534ee372a097ee5e55da9d83ef3cf20a
|
@@ -326,7 +326,7 @@ class Scaffolding::RoutesFileManipulator
|
|
326
326
|
within = find_or_create_namespaces(base_namespaces)
|
327
327
|
|
328
328
|
# e.g. Project and Projects::Deliverable
|
329
|
-
if parent_namespaces.empty? && child_namespaces.
|
329
|
+
if parent_namespaces.empty? && child_namespaces.any? && parent_resource == child_namespaces.first
|
330
330
|
|
331
331
|
# resources :projects do
|
332
332
|
# scope module: 'projects' do
|
@@ -343,19 +343,40 @@ class Scaffolding::RoutesFileManipulator
|
|
343
343
|
scope_within = insert([line, "end"], parent_within)
|
344
344
|
end
|
345
345
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
346
|
+
if child_namespaces.size > 1
|
347
|
+
# If a model has multiple namespaces, we have to account for that here.
|
348
|
+
# For example, this creates the :issues namespace here when `SendAction`
|
349
|
+
# and the `parent_resource` is `newsletters`.
|
350
|
+
#
|
351
|
+
# resources :newsletters do
|
352
|
+
# scope module: 'newsletters' do
|
353
|
+
# resources :issues, only: collection_actions
|
354
|
+
# namespace :issues do
|
355
|
+
# resources :send_actions, shallow: false
|
356
|
+
# end
|
357
|
+
# end
|
358
|
+
# end
|
359
|
+
|
360
|
+
# TODO: We should be able to just do `child_namespaces.shift`.
|
361
|
+
child_namespaces_without_parent = child_namespaces.dup
|
362
|
+
child_namespaces_without_parent.shift
|
363
|
+
deeply_nested_within = find_or_create_namespaces(child_namespaces_without_parent, scope_within)
|
364
|
+
find_or_create_resource([child_resource], options: "shallow: false", within: deeply_nested_within)
|
365
|
+
else
|
366
|
+
find_or_create_resource([child_resource], options: "only: collection_actions", within: scope_within)
|
367
|
+
|
368
|
+
# namespace :projects do
|
369
|
+
# resources :deliverables, except: collection_actions
|
370
|
+
# end
|
371
|
+
|
372
|
+
# We want to see if there are any namespaces one level above the parent itself,
|
373
|
+
# because namespaces with the same name as the resource can exist on the same level.
|
374
|
+
parent_block_start = Scaffolding::BlockManipulator.find_block_parent(parent_within, lines)
|
375
|
+
namespace_line_within = find_or_create_namespaces(child_namespaces, parent_block_start)
|
376
|
+
find_or_create_resource([child_resource], options: "except: collection_actions", within: namespace_line_within)
|
377
|
+
unless find_namespaces(child_namespaces, within)[child_namespaces.last]
|
378
|
+
raise "tried to insert `namespace :#{child_namespaces.last}` but it seems we failed"
|
379
|
+
end
|
359
380
|
end
|
360
381
|
|
361
382
|
# e.g. Projects::Deliverable and Objective Under It, Abstract::Concept and Concrete::Thing
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-super_scaffolding
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|