-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Should it be allowed to generate live/html/json/... without attributes? #5714
Comments
If there are no columns, maybe the generator should then use the id column as the initial column? |
I am trying to understand if there is a real use case behind a generation without any attribute. Fixing the table in the index is easy as you said by just showing the ID column. However, there are some other small changes that need to be done to make this work and I don't know if they are worthy. For example, in the I am happy to do those changes to the generator if it helps, but I am leaning more toward the option of just fail if the |
I got the same error when I ran the phx.gen.html with --no-context and --no-schema. The use case then would be when someone generates a context with a schema first and then runs the phx.gen.html to generate the HTML scaffolding. |
@SteffenDE @josevalim I can make a PR for this, starting with |
Environment
Actual behavior
After a generation without attributes:
and adding the routes I get an error on the view:
Expected behavior
The error itself make sense, I wonder if there are cases when it's useful to use the generator without providing attributes or it's just an error.
Please, let me know if it's an error and I can try to provide a patch.
The text was updated successfully, but these errors were encountered: