Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column not created in migration for _ids variant of super_select fields #1505

Open
jagthedrummer opened this issue May 31, 2024 · 2 comments

Comments

@jagthedrummer
Copy link
Contributor

I did this:

rails g super_scaffold Category Team name:text_field related_team_ids:super_select{class_name=Team}

And the migration didn't include a column for related_team_ids.

But if I do the singular version like this:

rails g super_scaffold Category Team name:text_field related_team_id:super_select{class_name=Team}

then a column is created for related_team_id.

@jagthedrummer
Copy link
Contributor Author

After looking at this I think that it's user error. I probably should have generated a join model first. That bit of the documentation could probably stand to be clearer. I had originally thought that I'd get an array column that would hold a collection of Team ids. (Which might be a nice thing to be able to do somehow. Similar to how we store role_ids on the Membership model.)

@jagthedrummer
Copy link
Contributor Author

Seems like in this case we should warn the user that the use of _ids in the field name would seem to imply that they need a join model but that we can't find one. And we could recommend using {vanilla} like we do for singular _id columns.

https://github.com/bullet-train-co/bullet_train-core/blob/9b7f280d3a981b11f8f925e946ebff4c1d029436/bullet_train-super_scaffolding/lib/scaffolding/script.rb#L142-L183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant