-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
super_scaffold:join_model hangs? #1457
super_scaffold:join_model hangs? #1457
Comments
All scaffolds that were used to get to this point are here: https://github.com/swombat/promptcraft/blob/main/SCAFFOLDING.md |
@swombat I don't know if it would help but you might try making the namespace for |
Ah, perhaps! I stopped using namespaces because of the other issues with them (sortable, etc), so I forgot this little trick... Will try again. |
@swombat I just ran all of the scaffolders from your repo (https://github.com/swombat/promptcraft/blob/main/SCAFFOLDING.md) and then experimented with the join model you listed in this issue. If I pluralize the namespace it doesn't hang.
So far I haven't been able to figure out exactly what's happening when it does hang with the singular version. |
OK, I see what's causing the hang. If you run the model generation command that super scaffolding runs for you it asks if you want to overwrite the singularized
We should probably try to detect that the "namespace parent file" collides with an existing model, warn you about it, and bail out. |
@gazayas, just wanted to ping you and see if you have an immediate feel for where this should be done. In the |
@jagthedrummer I reflected on namespaces a little while back here, and I think it's more of a Bullet Train philosophy/framework-wide issue, so maybe script.rb would be a good place to check for the parent (can't say off the top of my head). Definitely not good if the script is hanging when we should be bailing out instead. I'll try to think of a good spot for it in the meantime! |
I just confirmed that this same issue happens if you super scaffold a normal model (not a join model) with a namespace that matches an existing model. For instance:
Definitely seems like we need a common solution for both types of scaffolders. |
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 ```
➜ promptcraft git:(main) rails generate super_scaffold:join_model InputItem::PromptExecution prompt_execution_id{class_name=PromptExecution} input_item_id{class_name=InputItem} Generating model with 'bin/rails generate model InputItem::PromptExecution prompt_execution:references input_item:references'
This will just hang there until I kill it. Then:
I think it's creating the files that it is creating correctly, but I guess some files are missing...
app/models/input_item/prompt_execution.rb
:The text was updated successfully, but these errors were encountered: