Action Models scaffolding fails the valid attribute type check
gazayas opened this issue · comments
We provide this example in the Action Models documentation.
bin/super-scaffold crud Project Team name:text_field
bin/super-scaffold action-model:targets-many Archive Project Team
There are two problems with this.
bin/super-scaffold
is deprecated and we should update the documentation to userails generate super_scaffold
instead (I overlooked this in #699).- Running the second command fails the valid attribute type check.
> bin/super-scaffold action-model:targets-many Archive Project Team
DEPRECATION WARNING: `bin/super-scaffold` is deprecated. Please use `rails generate super_scaffold` instead.
You can see which options are available in the Super Scaffolding documentation: https://bullettrain.co/docs/super-scaffolding
/home/gazayas/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bullet_train-super_scaffolding-1.6.24/lib/scaffolding/script.rb:103:in `block in check_required_options_for_attributes': You have entered an invalid attribute type: . General data types are used when creating new models, but Bullet Train uses field partials when Super Scaffolding, i.e. - `name:text_field` as opposed to `name:string`. Please refer to the Field Partial documentation to view which attribute types are available. (RuntimeError)
Ultimately I think this is the command we'll want to run:
rails generate super_scaffold:action_model:targets_many Archive Project Team
When we deprecated bin/super-scaffold
it wasn't an issue for all of the other types of super scaffolding, but we didn't add an Action Models generator, so we don't currently have way to add them. Thinking back to this PR where we just wrapped rails g super_scaffold
with bin/super-scaffold
: bullet-train-co/bullet_train#1203
Will continue to try to fix this one.
This also may mean we'll have to move CI tests over to GitHub actions in the Action Models repository as well since we have a system test in place.
To be more specific, the error from above was happening because bin/super-scaffold
simply wasn't supporting bin/super-scaffold action-models:{action-name}
and was trying to force the usual crud
action instead.