bullet_train-super_scaffolding 1.6.8 → 1.6.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a81928799da06bd66f5a448dcca5c0ab9ab320634bce133c0e2f27ce2989033
|
4
|
+
data.tar.gz: 6c9308af45451d22d1cfb3290702144b15dc946392595143810186d96c298091
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 489d045886f249d95899ef983aeb531291320a25693270c0d083633b375e8f8e1b138004fe998db6cb2396bd5b4ba180c56fc62b3d8977c5c2e79d979b4f7b40
|
7
|
+
data.tar.gz: 7a63f65facdced42273921ec43dd5f52b6c9a267b207d61a0fcbc2cff35f2371d86f6613eb9bbbd09b94f87fe07e736060f35a16eece157d163d7c531d8bf3e3
|
@@ -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.10
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|