bullet_train 1.6.20 → 1.6.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/field-partials/file-field.md +3 -3
- data/docs/field-partials.md +1 -1
- data/docs/getting-started.md +5 -5
- data/docs/modeling.md +2 -2
- data/docs/namespacing.md +1 -1
- data/docs/oauth.md +1 -1
- data/docs/super-scaffolding/delegated-types.md +1 -1
- data/docs/super-scaffolding/options.md +1 -1
- data/docs/super-scaffolding/sortable.md +2 -2
- data/docs/super-scaffolding.md +38 -28
- data/docs/webhooks/incoming.md +1 -1
- data/lib/bullet_train/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a5f3e29089c8f6b06f331db595a0d45a908819dc154fbbec92efc5e421f4c85
|
4
|
+
data.tar.gz: 2b77d1c60706d9176d60bb76b3c700f3e3d03b5c011fc906e84a04214a810e97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feeaf9d82de33eaaed16fd1c662c37f770f1fc96c9108674d3537f2902099baffc0a5350d97c3f1b873f0779bbc33bb8c98535bf1ffc58af88b0ef3d3420fad9
|
7
|
+
data.tar.gz: 399b3bfdee6033be6c77e07a6bd7f97adb8bf6c3ff1103ac88847a59f3a55e01e6a39ce84865d454031f7fac5a50db73954ae32cfe53bd47d57f84a2c63846d9
|
@@ -21,7 +21,7 @@ Note, no database migration is required as ActiveStorage uses its own tables to
|
|
21
21
|
Run the following command to generate the scaffolding for the `document` field on the `Post` model:
|
22
22
|
|
23
23
|
```bash
|
24
|
-
|
24
|
+
rails generate super_scaffold:field Post document:file_field
|
25
25
|
```
|
26
26
|
|
27
27
|
## Multiple Attachment Example
|
@@ -39,7 +39,7 @@ Note, no database migration is required as ActiveStorage uses its own tables to
|
|
39
39
|
Run the following command to generate the scaffolding for the `documents` field on the `Post` model:
|
40
40
|
|
41
41
|
```bash
|
42
|
-
|
42
|
+
rails generate super_scaffold:field Post documents:file_field{multiple}
|
43
43
|
```
|
44
44
|
|
45
45
|
## Generating a Model & Super Scaffold Example
|
@@ -47,5 +47,5 @@ Run the following command to generate the scaffolding for the `documents` field
|
|
47
47
|
If you're starting fresh, and don't have an existing model you can do something like this:
|
48
48
|
|
49
49
|
```
|
50
|
-
|
50
|
+
rails generate super_scaffold Project Team name:text_field specification:file_field documents:file_field{multiple}
|
51
51
|
```
|
data/docs/field-partials.md
CHANGED
@@ -149,7 +149,7 @@ For Cloudinary you should use `string`, and for ActiveStorage you should use `at
|
|
149
149
|
## A Note On Data Types
|
150
150
|
When creating a `multiple` option attribute, Bullet Train generates these values as a `jsonb`.
|
151
151
|
```
|
152
|
-
|
152
|
+
rails generate super_scaffold Project Team multiple_buttons:buttons{multiple}
|
153
153
|
```
|
154
154
|
|
155
155
|
This will run the following rails command.
|
data/docs/getting-started.md
CHANGED
@@ -8,18 +8,18 @@ Whether you want to build a new application with Bullet Train or contribute to B
|
|
8
8
|
|
9
9
|
If you're using Bullet Train for the first time, begin by learning these five important techniques:
|
10
10
|
|
11
|
-
1. Use `
|
11
|
+
1. Use `rails generate super_scaffold` to scaffold a new model:
|
12
12
|
|
13
13
|
```
|
14
|
-
|
14
|
+
rails generate super_scaffold Project Team name:text_field
|
15
15
|
```
|
16
16
|
|
17
|
-
In this example, `Team` refers to the immediate parent of the `Project` resource. For more details, just run `
|
17
|
+
In this example, `Team` refers to the immediate parent of the `Project` resource. For more details, just run `rails generate super_scaffold` or [read the documentation](/docs/super-scaffolding.md).
|
18
18
|
|
19
|
-
2. Use `
|
19
|
+
2. Use `rails generate super_scaffold:field` to add a new field to a model you've already scaffolded:
|
20
20
|
|
21
21
|
```
|
22
|
-
|
22
|
+
rails generate super_scaffold:field Project description:trix_editor
|
23
23
|
```
|
24
24
|
|
25
25
|
These first two points about Super Scaffolding are just the tip of the iceberg, so be sure to circle around and [read the full documentation](/docs/super-scaffolding.md).
|
data/docs/modeling.md
CHANGED
@@ -44,7 +44,7 @@ In traditional Rails development, it can be so much work to bring your domain mo
|
|
44
44
|
|
45
45
|
### Focus on the structure and namespacing. Don't worry about every attribute.
|
46
46
|
|
47
|
-
One of the unique features of Super Scaffolding is that it allows you to scaffold additional attributes with `
|
47
|
+
One of the unique features of Super Scaffolding is that it allows you to scaffold additional attributes with `rails generate super_scaffold:field` after the initial scaffolding of a model with `rails generate super_scaffold`. That means that you don't have to worry about figuring out every single attribute that might exist on a model before running Super Scaffolding. Instead, the really important piece is:
|
48
48
|
|
49
49
|
1. Naming the model.
|
50
50
|
2. Determining which parent model it primarily belongs to.
|
@@ -68,7 +68,7 @@ Even if you know there's an attribute or model that you're going to want to poli
|
|
68
68
|
|
69
69
|
## A Systematic Approach
|
70
70
|
|
71
|
-
### 1. Write `
|
71
|
+
### 1. Write `rails generate super_scaffold` commands in a scratch file.
|
72
72
|
|
73
73
|
See the [Super Scaffolding documentation](/docs/super-scaffolding.md) for more specific guidance. Leave plenty of comments in your scratch file describing anything that isn't obvious and providing examples of values that might populate attributes.
|
74
74
|
|
data/docs/namespacing.md
CHANGED
@@ -7,5 +7,5 @@ Bullet Train comes preconfigured with an `Account` namespace for controllers and
|
|
7
7
|
In Bullet Train applications with [multiple team types](/docs/teams.md), you may find it helpful to introduce additional controller and view namespaces to represent and organize user interfaces and experiences for certain team types that vary substantially from the `Account` namespace default. In Super Scaffolding, you can specify a namespace other than `Account` with the `--namespace` option, for example:
|
8
8
|
|
9
9
|
```
|
10
|
-
|
10
|
+
rails generate super_scaffold Event Team name:text_field --namespace=customers
|
11
11
|
```
|
data/docs/oauth.md
CHANGED
@@ -4,7 +4,7 @@ Bullet Train includes [Omniauth](https://github.com/omniauth/omniauth) by defaul
|
|
4
4
|
For specific instructions on adding new OAuth providers, run the following on your shell:
|
5
5
|
|
6
6
|
```
|
7
|
-
|
7
|
+
rails generate super_scaffold:oauth_provider
|
8
8
|
```
|
9
9
|
|
10
10
|
## Stripe Connect Example
|
@@ -39,7 +39,7 @@ Note that in this specific approach we don't need a `team:references` on `Messag
|
|
39
39
|
### 2. Super Scaffolding for `Entry`
|
40
40
|
|
41
41
|
```
|
42
|
-
|
42
|
+
rails generate super_scaffold Entry Team entryable_type:buttons --skip-migration-generation
|
43
43
|
```
|
44
44
|
|
45
45
|
We use `entryable_type:buttons` because we're going to allow people to choose which type of `Entry` they're creating with a list of buttons. This isn't the only option available to us, but it's the easiest to implement for now.
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
There are different flags you can pass to the Super Scaffolding command which gives you more flexibility over creating your model. Add the flag of your choice to **the end** of the command for the option to take effect.
|
4
4
|
```
|
5
|
-
|
5
|
+
rails generate super_scaffold Project Team description:text_field --sortable
|
6
6
|
```
|
7
7
|
|
8
8
|
Most of these include skipping particular functionalities, so take a look at what's available here and pass the flag that applies to your use-case.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# Super Scaffolding with the `--sortable` option
|
2
2
|
|
3
|
-
When issuing a `
|
3
|
+
When issuing a `rails generate super_scaffold` command, you can pass the `--sortable` option like this:
|
4
4
|
|
5
5
|
```
|
6
6
|
# E.g. Pages belong to a Site and are sortable via drag-and-drop:
|
7
|
-
|
7
|
+
rails generate super_scaffold Page Site,Team name:text_field path:text_area --sortable
|
8
8
|
```
|
9
9
|
|
10
10
|
The `--sortable` option:
|
data/docs/super-scaffolding.md
CHANGED
@@ -30,20 +30,30 @@ Before getting started with Super Scaffolding, we recommend reading about [the p
|
|
30
30
|
The Super Scaffolding shell script provides its own documentation. If you're curious about specific scaffolders or parameters, you can run the following in your shell:
|
31
31
|
|
32
32
|
```
|
33
|
-
|
33
|
+
rails generate super_scaffold
|
34
34
|
```
|
35
35
|
|
36
|
+
## Available Scaffolding Types
|
37
|
+
|
38
|
+
| `rails generate` Command | Scaffolding Type |
|
39
|
+
|--------------------------|------------------|
|
40
|
+
| `rails generate super_scaffold` | Basic CRUD scaffolder |
|
41
|
+
| `rails generate super_scaffold:field` | Adds a field to an existing model |
|
42
|
+
| `rails generate super_scaffold:incoming_webhook` | Scaffolds an incoming webhook |
|
43
|
+
| `rails generate super_scaffold:join_model` | Scaffolds a join model (must have two existing models to join before scaffolding) |
|
44
|
+
| `rails generate super_scaffold:oauth_provider` | Scaffolds logic to use OAuth2 with the provider of your choice |
|
45
|
+
|
36
46
|
## Examples
|
37
47
|
|
38
|
-
### 1. Basic CRUD Scaffolding
|
48
|
+
### 1. Basic CRUD Scaffolding
|
39
49
|
|
40
50
|
Let's implement the following feature:
|
41
51
|
|
42
52
|
> An organization has many projects.
|
43
53
|
|
44
|
-
First, run the
|
54
|
+
First, run the scaffolder:
|
45
55
|
```
|
46
|
-
|
56
|
+
rails generate super_scaffold Project Team name:text_field
|
47
57
|
rake db:migrate
|
48
58
|
```
|
49
59
|
|
@@ -60,10 +70,10 @@ rails g model Project team:references name:string
|
|
60
70
|
|
61
71
|
Then you can run the scaffolder with the flag:
|
62
72
|
```
|
63
|
-
|
73
|
+
rails generate super_scaffold Project Team name:text_field --skip-migration-generation
|
64
74
|
```
|
65
75
|
|
66
|
-
### 2. Nested CRUD Scaffolding
|
76
|
+
### 2. Nested CRUD Scaffolding
|
67
77
|
|
68
78
|
Building on that example, let's implement the following feature:
|
69
79
|
|
@@ -71,40 +81,40 @@ Building on that example, let's implement the following feature:
|
|
71
81
|
A project has many goals.
|
72
82
|
```
|
73
83
|
|
74
|
-
First, run the
|
84
|
+
First, run the scaffolder:
|
75
85
|
|
76
86
|
```
|
77
|
-
|
87
|
+
rails generate super_scaffold Goal Project,Team description:text_field
|
78
88
|
rake db:migrate
|
79
89
|
```
|
80
90
|
|
81
91
|
You can see in the example above how we've specified `Project,Team`, because we want to specify the entire chain of ownership back to the `Team`. This allows Super Scaffolding to automatically generate the required permissions. Take note that this generates a foreign key for `Project` and not for `Team`.
|
82
92
|
|
83
|
-
### 3. Adding New Fields with `
|
93
|
+
### 3. Adding New Fields with `field`
|
84
94
|
|
85
|
-
One of Bullet Train's most valuable features is the ability to add new fields to existing scaffolded models. When you add new fields with the `
|
95
|
+
One of Bullet Train's most valuable features is the ability to add new fields to existing scaffolded models. When you add new fields with the `field` scaffolder, you don't have to remember to add that same attribute to table views, show views, translation files, API endpoints, serializers, tests, documentation, etc.
|
86
96
|
|
87
97
|
Building on the earlier example, consider the following new requirement:
|
88
98
|
|
89
99
|
> In addition to a name, a project can have a description.
|
90
100
|
|
91
|
-
Use the `
|
101
|
+
Use the `field` scaffolder to add it throughout the application:
|
92
102
|
|
93
103
|
```
|
94
|
-
|
104
|
+
rails generate super_scaffold:field Project description:trix_editor
|
95
105
|
rake db:migrate
|
96
106
|
```
|
97
107
|
|
98
|
-
As you can see, when we're using `
|
108
|
+
As you can see, when we're using `field`, we don't need to supply the chain of ownership back to `Team`.
|
99
109
|
|
100
110
|
If you want to scaffold a new field to use for read-only purposes, add the following option to omit the field from the form and all other files that apply:
|
101
111
|
```
|
102
|
-
|
112
|
+
rails generate super_scaffold:field Project description:trix_editor{readonly}
|
103
113
|
```
|
104
114
|
|
105
115
|
Again, if you would like to automatically generate the migration on your own, pass the `--skip-migration-generation` flag:
|
106
116
|
```
|
107
|
-
|
117
|
+
rails generate super_scaffold:field Project description:trix_editor --skip-migration-generation
|
108
118
|
```
|
109
119
|
|
110
120
|
### 4. Adding Option Fields with Fixed, Translatable Options
|
@@ -118,7 +128,7 @@ We have multiple [field partials](/docs/field-partials.md) that we could use for
|
|
118
128
|
In this example, let's add a status attribute and present it as buttons:
|
119
129
|
|
120
130
|
```
|
121
|
-
|
131
|
+
rails generate super_scaffold:field Project status:buttons
|
122
132
|
```
|
123
133
|
|
124
134
|
By default, Super Scaffolding configures the buttons as "One", "Two", and "Three", but in this example you can edit those options in the `fields` section of `config/locales/en/projects.en.yml`. For example, you could specify the following options:
|
@@ -146,7 +156,7 @@ Although you might think this calls for a reference to `User`, we've learned the
|
|
146
156
|
We can accomplish this like so:
|
147
157
|
|
148
158
|
```
|
149
|
-
|
159
|
+
rails generate super_scaffold:field Project lead_id:super_select{class_name=Membership}
|
150
160
|
rake db:migrate
|
151
161
|
```
|
152
162
|
|
@@ -166,7 +176,7 @@ end
|
|
166
176
|
|
167
177
|
(The `current_and_invited` scope just filters out people that have already been removed from the team.)
|
168
178
|
|
169
|
-
### 6. Scaffolding Has-Many-Through Associations with `
|
179
|
+
### 6. Scaffolding Has-Many-Through Associations with `join_model`
|
170
180
|
|
171
181
|
Finally, working from the same example, imagine the following requirement:
|
172
182
|
|
@@ -177,31 +187,31 @@ We can accomplish this with a new model, a new join model, and a `super_select`
|
|
177
187
|
First, let's create the tag model:
|
178
188
|
|
179
189
|
```
|
180
|
-
|
190
|
+
rails generate super_scaffold Projects::Tag Team name:text_field
|
181
191
|
```
|
182
192
|
|
183
193
|
Note that project tags are specifically defined at the `Team` level. The same tag can be applied to multiple `Project` models.
|
184
194
|
|
185
195
|
Now, let's create a join model for the has-many-through association.
|
186
196
|
|
187
|
-
We're not going to scaffold this model with the typical `
|
197
|
+
We're not going to scaffold this model with the typical `rails generate super_scaffold` scaffolder, but some preparation is needed before we can use it with the `field` scaffolder, so we need to do the following:
|
188
198
|
|
189
199
|
```
|
190
|
-
|
200
|
+
rails generate super_scaffold:join_model Projects::AppliedTag project_id{class_name=Project} tag_id{class_name=Projects::Tag}
|
191
201
|
```
|
192
202
|
|
193
203
|
All we're doing here is specifying the name of the join model, and the two attributes and class names of the models it joins. Note again that we specify the `_id` suffix on both of the attributes.
|
194
204
|
|
195
|
-
Now that the join model has been prepared, we can use the `
|
205
|
+
Now that the join model has been prepared, we can use the `field` scaffolder to create the multi-select field:
|
196
206
|
|
197
207
|
```
|
198
|
-
|
208
|
+
rails generate super_scaffold:field Project tag_ids:super_select{class_name=Projects::Tag}
|
199
209
|
rake db:migrate
|
200
210
|
```
|
201
211
|
|
202
212
|
Just note that the suffix of the field is `_ids` plural, and this is an attribute provided by Rails to interact with the `has_many :tags, through: :applied_tags` association.
|
203
213
|
|
204
|
-
The `
|
214
|
+
The `field` step will ask you to define the logic for the `valid_tags` method in `app/models/project.rb`. You can define it like so:
|
205
215
|
|
206
216
|
```ruby
|
207
217
|
def valid_tags
|
@@ -228,13 +238,13 @@ For instance to scaffold a `Project` model with a `logo` image upload.
|
|
228
238
|
Use `image` as a field type for super scaffolding:
|
229
239
|
|
230
240
|
```
|
231
|
-
|
241
|
+
rails generate super_scaffold Project Team name:text_field logo:image
|
232
242
|
rake db:migrate
|
233
243
|
```
|
234
244
|
|
235
245
|
Under the hood, Bullet Train will generate your model with the following command:
|
236
246
|
```
|
237
|
-
|
247
|
+
rails generate super_scaffold Project Team name:text_field
|
238
248
|
rake db:migrate
|
239
249
|
```
|
240
250
|
|
@@ -246,13 +256,13 @@ For instance to scaffold a `Project` model with a `logo` image upload.
|
|
246
256
|
Use `image` as a field type for super scaffolding:
|
247
257
|
|
248
258
|
```
|
249
|
-
|
259
|
+
rails generate super_scaffold Project Team name:text_field logo:image
|
250
260
|
rake db:migrate
|
251
261
|
```
|
252
262
|
|
253
263
|
Under the hood, Bullet Train will generate your model with the following command:
|
254
264
|
```
|
255
|
-
|
265
|
+
rails generate super_scaffold Project Team name:text_field
|
256
266
|
rake db:migrate
|
257
267
|
```
|
258
268
|
|
data/docs/webhooks/incoming.md
CHANGED
@@ -3,5 +3,5 @@
|
|
3
3
|
Bullet Train makes it trivial to scaffold new endpoints where external systems can send you webhooks and they can be processed asyncronously in a background job. For more information, run:
|
4
4
|
|
5
5
|
```
|
6
|
-
|
6
|
+
rails generate super_scaffold:incoming_webhooks
|
7
7
|
```
|
data/lib/bullet_train/version.rb
CHANGED
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.6.
|
4
|
+
version: 1.6.21
|
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
|
+
date: 2023-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|