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

Raise an error if a namespaced model would clobber an existing class #845

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

jagthedrummer
Copy link
Contributor

Fixes: bullet-train-co/bullet_train#1457

Previously superscaffolding commands would hang indefinitely if you tried to geneate a model that has a namespace that exactly matches an existing class.

Now we'll detect that problem and will show you a message letting you know that you need to deconflict the namespace.

$ rails generate super_scaffold:join_model InputItem::PromptExecution prompt_execution_id{class_name=PromptExecution} input_item_id{class_name=InputItem}
It looks like the namespace you gave for this model conflicts with an existing class: InputItem
You should use a namespace that doesn't clobber an existing class.

We reccomend using the pluralized version of the existing class.

For instance instead of InputItem use InputItems

Fixes: bullet-train-co/bullet_train#1457

Previously superscaffolding commands would hang indefinitely if you
tried to geneate a model that has a namespace that exactly matches an
existing class.

Now we'll detect that problem and will show you a message letting you
know that you need to deconflict the namespace.

```
$ rails generate super_scaffold:join_model InputItem::PromptExecution prompt_execution_id{class_name=PromptExecution} input_item_id{class_name=InputItem}
It looks like the namespace you gave for this model conflicts with an existing class: InputItem
You should use a namespace that doesn't clobber an existing class.

We reccomend using the pluralized version of the existing class.

For instance instead of InputItem use InputItems
```
@jagthedrummer jagthedrummer merged commit 143b784 into main Jun 5, 2024
30 checks passed
@jagthedrummer jagthedrummer deleted the jeremy/super-scaffolding-namespace-fix branch June 5, 2024 16:38
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

Successfully merging this pull request may close these issues.

super_scaffold:join_model hangs?
1 participant