bullet_train 1.12.2 β†’ 1.12.3

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: 359c742c2ad95d55fd469407fac668cbd94d6fd43643c0e1dedd705afaff1564
4
- data.tar.gz: 504b342f64b691e89630dde9dd763bbcd9c23056c4fc6437532993e417f0716b
3
+ metadata.gz: 918897d730dbf7dd7fd31f51609a2fbd25c56800a6442b3b0caa81ed7a9f8f40
4
+ data.tar.gz: 45a93a17f839e4a1e03a193f88cb6a8e23d81150bb17d8059473f4d86484cecf
5
5
  SHA512:
6
- metadata.gz: 4099fd8c3c38bed877f1844127f998fc2b16d64beb9b4f3ff637f4706c18f8d0fdb74c5b1264c13a1e72b80d98cb0c71be799100f93a903480447562abbe2396
7
- data.tar.gz: 0a74b016a9d0d7b027ce2c73cff11abfe6dc341d77854a50dbb127c086188187186c98ed23ed728d867d711c18339f0185c3699ec8dde5f09caa5435fda010a3
6
+ metadata.gz: 44f73475e4a154a35aa52ca0edb39900e23d286d1b870a1ba537a88997fdeac49986250719241ba081c8fecdf06c993436a753c569599862d9213f7e0123012b
7
+ data.tar.gz: ad26cf90042f42fec84595cf292bb9556131d0e2ffc40368857017e78c7aec83ea2e6430b9cc9ee601d41a942de06b3f34d484153f5bfabc8b325675c3c01f23
@@ -0,0 +1,104 @@
1
+ # Targets for Super Scaffolding
2
+
3
+ Super Scaffolding relies on "magic comments" that we use as targets (also known as hooks) that help us put newly generated code in the right place.
4
+
5
+ For instance if you Super Scaffold a `Project` resource your model file will look like this:
6
+
7
+ ```ruby
8
+ class Project < ApplicationRecord
9
+ # πŸš… add concerns above.
10
+
11
+ # πŸš… add attribute accessors above.
12
+
13
+ belongs_to :team
14
+ # πŸš… add belongs_to associations above.
15
+
16
+ # πŸš… add has_many associations above.
17
+
18
+ # πŸš… add has_one associations above.
19
+
20
+ # πŸš… add scopes above.
21
+
22
+ validates :name, presence: true
23
+ # πŸš… add validations above.
24
+
25
+ # πŸš… add callbacks above.
26
+
27
+ # πŸš… add delegations above.
28
+
29
+ # πŸš… add methods above.
30
+ end
31
+ ```
32
+
33
+ All of those comments are used by the Super Scaffolder to put things in the right place.
34
+
35
+ **DON'T REMOVE THEM!**
36
+
37
+ If you remove them then we won't be able to make modifications to that file, and subsequent super scaffolding commands won't work correctly.
38
+
39
+ If you do remove them then you should see a warning the next time you try to add a field that requires modifications that model. (Not all attribute types do. File and Image fields are examples of ones that do.)
40
+
41
+ ```
42
+ $ rails generate super_scaffold:field Project documents:file_field{multiple}
43
+ Adding new fields to Project with 'bin/rails generate migration add_documents_to_projects documents:attachments'
44
+
45
+ Updating './app/views/account/projects/_form.html.erb'.
46
+ Updating './app/views/account/projects/show.html.erb'.
47
+ Updating './app/views/account/projects/_index.html.erb'.
48
+ Replacing in './app/views/account/projects/_index.html.erb'.
49
+ Updating './app/views/account/projects/_project.html.erb'.
50
+ Updating './config/locales/en/projects.en.yml'.
51
+ Updating './config/locales/en/projects.en.yml'.
52
+ Updating './app/controllers/api/v1/projects_controller.rb'.
53
+ Updating './app/controllers/api/v1/projects_controller.rb'.
54
+ Updating './test/controllers/api/v1/projects_controller_test.rb'.
55
+ Updating './app/views/api/v1/projects/_project.json.jbuilder'.
56
+ Updating './test/controllers/api/v1/projects_controller_test.rb'.
57
+
58
+ -------------------------------
59
+ Heads up! We weren't able to find a super scaffolding hook where we expected it to be.
60
+ In ./app/models/project.rb
61
+ We expected to find a line like this:
62
+ # πŸš… add has_many associations above.
63
+
64
+ See https://bullettrain.co/docs/super-scaffolding/targets for more details.
65
+ -------------------------------
66
+
67
+
68
+ -------------------------------
69
+ Heads up! We weren't able to find a super scaffolding hook where we expected it to be.
70
+ In ./app/models/project.rb
71
+ We expected to find a line like this:
72
+ # πŸš… add attribute accessors above.
73
+
74
+ See https://bullettrain.co/docs/super-scaffolding/targets for more details.
75
+ -------------------------------
76
+
77
+
78
+ -------------------------------
79
+ Heads up! We weren't able to find a super scaffolding hook where we expected it to be.
80
+ In ./app/models/project.rb
81
+ We expected to find a line like this:
82
+ # πŸš… add methods above.
83
+
84
+ See https://bullettrain.co/docs/super-scaffolding/targets for more details.
85
+ -------------------------------
86
+
87
+
88
+ -------------------------------
89
+ Heads up! We weren't able to find a super scaffolding hook where we expected it to be.
90
+ In ./app/models/project.rb
91
+ We expected to find a line like this:
92
+ # πŸš… add callbacks above.
93
+
94
+ See https://bullettrain.co/docs/super-scaffolding/targets for more details.
95
+ -------------------------------
96
+ ```
97
+
98
+ ## How to Replace Missing Targets
99
+
100
+ If you've removed some targets and need to get them back you have a few options:
101
+
102
+ 1. If the removal of the targets hasn't been committed to source control yet, you can use `git checkout` to restore the files to their previous state.
103
+ 2. If the removal has been committed you could revert the commit that removed them.
104
+ 3. You could use Super Scaffolding to generate a new resource and then copy &amp; paste the targets from your new resource into the existing one.
@@ -17,6 +17,8 @@ Here’s a list of what Super Scaffolding takes care of for you each time you ad
17
17
 
18
18
  When adding just one model, Super Scaffolding generates ~30 different files on your behalf.
19
19
 
20
+ **NOTE** Super Scaffolding generates code that contains special "magic comments" that we use as targets for later Super Scaffolding operations. You shouldn't remove those comments. See [Targets for Super Scaffolding](/docs/super-scaffolding/targets.md) for more details.
21
+
20
22
  ## Living Templates
21
23
 
22
24
  Bullet Train's Super Scaffolding engine is a unique approach to code generation, based on template files that are functional code instead of obscure DSLs that are difficult to customize and maintain. Super Scaffolding automates the most repetitive and mundane aspects of building out your application's basic structure. Furthermore, it does this without leaning on the magic of libraries that force too high a level of abstraction. Instead, it generates standard Rails code that is both ready for prime time, but is also easy to customize and modify.
@@ -184,6 +186,20 @@ end
184
186
 
185
187
  (The `current_and_invited` scope just filters out people that have already been removed from the team.)
186
188
 
189
+ **NOTE:** It's possible to define the source for `valid_leads` in your super scaffolding command.
190
+ You need to wrap the bits inside the curly brackets with double qoutes, and then add
191
+ `,source=team.memberships.current_and_invited` inside the quotes:
192
+
193
+ ```
194
+ {"class_name=Membership,source=team.memberships.current_and_invited"}
195
+ ```
196
+
197
+ So the whole command would be:
198
+
199
+ ```
200
+ rails generate super_scaffold:field Project lead_id:super_select{"class_name=Membership,source=team.memberships.current_and_invited"}
201
+ ```
202
+
187
203
  ### 6. Scaffolding Has-Many-Through Associations with `join_model`
188
204
 
189
205
  Finally, working from the same example, imagine the following requirement:
@@ -299,3 +315,7 @@ HIDE_THINGS: true
299
315
  - [Super Scaffolding Options](/docs/super-scaffolding/options.md)
300
316
  - [Super Scaffolding with Delegated Types](/docs/super-scaffolding/delegated-types.md)
301
317
  - [Super Scaffolding with the `--sortable` option](/docs/super-scaffolding/sortable.md)
318
+
319
+ ## Additional Info
320
+
321
+ - [Targets for Super Scaffolding](/docs/super-scaffolding/targets.md)
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.12.2"
2
+ VERSION = "1.12.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard
@@ -780,6 +780,7 @@ files:
780
780
  - docs/super-scaffolding/delegated-types.md
781
781
  - docs/super-scaffolding/options.md
782
782
  - docs/super-scaffolding/sortable.md
783
+ - docs/super-scaffolding/targets.md
783
784
  - docs/teams.md
784
785
  - docs/testing.md
785
786
  - docs/themes.md