You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overwriting existing controllers when generating a resource limits the utility of the gem. It makes it much more difficult to add Graphiti to an existing application.
Pain point
Adding Graphiti to an existing application with generate graphiti:resource [RESOURCE_NAME] --model=[MODEL_NAME] overwrites the existing controller. You can skip the overwrite, but then the controller code must be written by hand. Also, if you use destroy graphiti:resource... it deletes the controller file whether the generator initially overwrote the file or not. This inflexibility also increases the difficulty of calling the generator inside other custom generators.
Suggested solutions:
Break out the responsibilities of the ResourceGenerator into separate generators and create a single scaffold generator which incorporates all of the generators
The scaffold generator could have options to exclude specific generators (e.g. --no-controller)
Instead of overwriting controllers, create separate namespaced controllers specifically for Graphiti. The file structure could be sourced from the namespace recorded in .graphiticfg.yml.
Reacted by Raghu Betina, Jelani Woods, Thad Sauter, Dinesh Panda, arjan0307 and Nathaniel
I''m dealing with the same problem. The workaround I use is overwrite the controller, move the controller to the namespace and then use git checkout to restore the original controller, which is far from ideal.
Activity
arjan0307 commentedon May 7, 2020
I''m dealing with the same problem. The workaround I use is overwrite the controller, move the controller to the namespace and then use
git checkoutto restore the original controller, which is far from ideal.github-actions commentedon Aug 10, 2026
🎉 This issue has been resolved in version 2.0.0-beta.7 🎉
The release is available on:
v2.0.0-beta.7Your semantic-release bot 📦🚀
github-actions commentedon Aug 10, 2026
🎉 This issue has been resolved in version 2.0.0-beta.8 🎉
The release is available on:
v2.0.0-beta.8Your semantic-release bot 📦🚀
github-actions commentedon Sep 1, 2026
🎉 This issue has been resolved in version 2.0.0 🎉
The release is available on:
v2.0.0Your semantic-release bot 📦🚀