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: 83562ede1a8ba63e0c7ce22d2ad4b847966bad0c1cd9b768aa7eec899587181d
4
- data.tar.gz: 403160c7f8f5fe3250c8c2874272d9db05c95a52a38c516a206746f4180df8be
3
+ metadata.gz: 5a81928799da06bd66f5a448dcca5c0ab9ab320634bce133c0e2f27ce2989033
4
+ data.tar.gz: 6c9308af45451d22d1cfb3290702144b15dc946392595143810186d96c298091
5
5
  SHA512:
6
- metadata.gz: 1c6c3a03a78758c8347c1a3a1c841382ab55b486453bf7008358c6c42d6afff6159cf5f150f9cfba1684c91ade3b2c32f3ea26f766832badd2684fc3e875445d
7
- data.tar.gz: d019a81d9810e3586ba355e011dd1fbf19779963ca049b4df88a65ccb274387c488e7e74e4593f31fc20335e46359b86019f7b418336bfb71e1e0d83fe30b317
6
+ metadata.gz: 489d045886f249d95899ef983aeb531291320a25693270c0d083633b375e8f8e1b138004fe998db6cb2396bd5b4ba180c56fc62b3d8977c5c2e79d979b4f7b40
7
+ data.tar.gz: 7a63f65facdced42273921ec43dd5f52b6c9a267b207d61a0fcbc2cff35f2371d86f6613eb9bbbd09b94f87fe07e736060f35a16eece157d163d7c531d8bf3e3
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.6.8"
3
+ VERSION = "1.6.10"
4
4
  end
5
5
  end
@@ -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.one? && parent_resource == child_namespaces.first
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
- find_or_create_resource([child_resource], options: "only: collection_actions", within: scope_within)
347
-
348
- # namespace :projects do
349
- # resources :deliverables, except: collection_actions
350
- # end
351
-
352
- # We want to see if there are any namespaces one level above the parent itself,
353
- # because namespaces with the same name as the resource can exist on the same level.
354
- parent_block_start = Scaffolding::BlockManipulator.find_block_parent(parent_within, lines)
355
- namespace_line_within = find_or_create_namespaces(child_namespaces, parent_block_start)
356
- find_or_create_resource([child_resource], options: "except: collection_actions", within: namespace_line_within)
357
- unless find_namespaces(child_namespaces, within)[child_namespaces.last]
358
- raise "tried to insert `namespace :#{child_namespaces.last}` but it seems we failed"
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.8
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-01 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard