-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Correctly insert ActiveModel::default()
#97
Comments
@acidic9 |
A small fix would be to simple check that all fields in the active model are unset, and in that case Optimally, it would be best that this code doesn't even compile. This is why through my experience with using SeaOMR, it seems like it may be worth investigating having a separate struct for inserts. This is why it may be also worth investigating generating a |
Following up on this, I just thought that there may be cases where someone might actually want this. For example, if every column in the table has a default value. In which case the query should execute, but should not contain the parenthesis INSERT INTO "cakes" RETURNING "id" AS "last_insert_id" If I'm not wrong, this is a valid SQL query. But in the case of an update, perhaps it can be a NOOP. |
This returns a database error:
Because the generated query is:
@acidic9 thanks for reporting this!
The text was updated successfully, but these errors were encountered: