bullet_train-super_scaffolding 1.4.0 → 1.4.2

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: 261d7f697e72bdba89678e9a1e18dcfcea77a98d1662fdc31e585361e6f278f6
4
- data.tar.gz: 44f8a1cb83b867805a4b7397eff55f7bccf28e7897a500ef9615b92df8729a27
3
+ metadata.gz: 9918e6ea0b4d095abc3c543c2641beb4c4dee81b565ede37a4a0a7f2b9e227a2
4
+ data.tar.gz: 40a4d616eaf2f6421fe0be5fd8ae5a8bc74dfd1ed839d1cc8a5ffe191af58b7c
5
5
  SHA512:
6
- metadata.gz: 462548d87a9c8b5a7ecb190985b724e69ca17b65aa4213d3c5a45fba87d9ef0360ea762dca60ac6a96f22de3446b9c2ba2a8000895f99223ed2840b2319eec57
7
- data.tar.gz: 63fb92b8b6dc4523f5fc9f9535b82b7f286fb9d4a48bfb43f913c6e7214a217a48a3a3fc4122e56dd20d3ce59cbb0fba054a91d8e85431d468e530f38cb0115e
6
+ metadata.gz: 822bc34137853eed1546879f7a6030333420c97ce3ba20c3ea8bb027726c4d2945ff4e9c136e6ffe61fca887d26433119f309b0ed549d08ad1d7664b28c4960a
7
+ data.tar.gz: b113d0cf3babdbbc4a56fa067f19392592c1894fa8fb9e243b93b49f81f0312a5827c118262123c5c4e948776e1ce6a20eb97cb04fc6be0fad15b41d12b11ad3
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.4.0"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
@@ -64,8 +64,14 @@ def check_required_options_for_attributes(scaffolding_type, attributes, child, p
64
64
 
65
65
  attribute_options[:class_name] ||= name_without_id.classify
66
66
 
67
- file_name = "app/models/#{attribute_options[:class_name].underscore}.rb"
68
- unless File.exist?(file_name)
67
+ file_name = Dir.glob("app/models/**/*.rb").find { |model| model.match?(/#{attribute_options[:class_name].underscore}\.rb/) } || ""
68
+
69
+ # If a model is namespaced, the parent's model file might exist under
70
+ # `app/models/`, but sometimes these files are modules that resolve
71
+ # table names by providing a prefix as opposed to an actual ApplicationRecord.
72
+ # This check ensures that the _id attribute really is a model.
73
+ is_active_record_class = attribute_options[:class_name].constantize.ancestors.include?(ActiveRecord::Base)
74
+ unless File.exist?(file_name) && is_active_record_class
69
75
  puts ""
70
76
  puts "Attributes that end with `_id` or `_ids` trigger awesome, powerful magic in Super Scaffolding. However, because no `#{attribute_options[:class_name]}` class was found defined in `#{file_name}`, you'll need to specify a `class_name` that exists to let us know what model class is on the other side of the association, like so:".red
71
77
  puts ""
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.4.0
4
+ version: 1.4.2
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-09-08 00:00:00.000000000 Z
11
+ date: 2023-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -125,7 +125,6 @@ files:
125
125
  - app/views/account/scaffolding/completely_concrete/tangible_things/index.html.erb
126
126
  - app/views/account/scaffolding/completely_concrete/tangible_things/new.html.erb
127
127
  - app/views/account/scaffolding/completely_concrete/tangible_things/show.html.erb
128
- - app/views/api/v1/open_api/scaffolding/absolutely_abstract/creative_concepts/_paths.yaml.erb
129
128
  - app/views/api/v1/scaffolding/absolutely_abstract/creative_concepts/_creative_concept.json.jbuilder
130
129
  - app/views/api/v1/scaffolding/absolutely_abstract/creative_concepts/index.json.jbuilder
131
130
  - app/views/api/v1/scaffolding/absolutely_abstract/creative_concepts/show.json.jbuilder
@@ -1,93 +0,0 @@
1
- /teams/{team_id}/scaffolding/absolutely_abstract/creative_concepts:
2
- get:
3
- tags:
4
- - "Scaffolding/Absolutely Abstract/Creative Concept"
5
- summary: "List Creative Concept"
6
- operationId: listScaffoldingAbsolutelyAbstractCreativeConcepts
7
- parameters:
8
- - name: team_id
9
- in: path
10
- required: true
11
- schema:
12
- type: string
13
- responses:
14
- "404":
15
- description: "Not Found"
16
- "200":
17
- description: "OK"
18
- content:
19
- application/json:
20
- schema:
21
- type: object
22
- properties:
23
- data:
24
- type: array
25
- items:
26
- $ref: "#/components/schemas/ScaffoldingAbsolutelyAbstractCreativeConceptAttributes"
27
- has_more:
28
- type: boolean
29
- post:
30
- tags:
31
- - "Scaffolding/Absolutely Abstract/Creative Concept"
32
- summary: "Create Creative Concept"
33
- operationId: createScaffoldingAbsolutelyAbstractCreativeConcepts
34
- parameters:
35
- - name: team_id
36
- in: path
37
- required: true
38
- schema:
39
- type: string
40
- responses:
41
- "404":
42
- description: "Not Found"
43
- "201":
44
- description: "Created"
45
- content:
46
- application/json:
47
- schema:
48
- $ref: "#/components/schemas/ScaffoldingAbsolutelyAbstractCreativeConceptParameters"
49
- /scaffolding/absolutely_abstract/creative_concepts/{id}:
50
- get:
51
- tags:
52
- - "Scaffolding/Absolutely Abstract/Creative Concept"
53
- summary: "Fetch Creative Concept"
54
- operationId: getScaffoldingAbsolutelyAbstractCreativeConcepts
55
- parameters:
56
- - $ref: "#/components/parameters/id"
57
- responses:
58
- "404":
59
- description: "Not Found"
60
- "200":
61
- description: "OK"
62
- content:
63
- application/json:
64
- schema:
65
- $ref: "#/components/schemas/ScaffoldingAbsolutelyAbstractCreativeConceptAttributes"
66
- put:
67
- tags:
68
- - "Scaffolding/Absolutely Abstract/Creative Concept"
69
- summary: "Update Creative Concept"
70
- operationId: updateScaffoldingAbsolutelyAbstractCreativeConcepts
71
- parameters:
72
- - $ref: "#/components/parameters/id"
73
- responses:
74
- "404":
75
- description: "Not Found"
76
- "200":
77
- description: "OK"
78
- content:
79
- application/json:
80
- schema:
81
- $ref: "#/components/schemas/ScaffoldingAbsolutelyAbstractCreativeConceptParameters"
82
- delete:
83
- tags:
84
- - "Scaffolding/Absolutely Abstract/Creative Concept"
85
- summary: "Remove Creative Concept"
86
- operationId: removeScaffoldingAbsolutelyAbstractCreativeConcepts
87
- parameters:
88
- - $ref: "#/components/parameters/id"
89
- responses:
90
- "404":
91
- description: "Not Found"
92
- "200":
93
- description: "OK"