-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Improved the error messaging for the DangerousAttributeError exception #16669
Improved the error messaging for the DangerousAttributeError exception #16669
Conversation
Seems reasonable |
This could cause confusion when the conflicting method is not a column on the models table. For example when defining an |
fe558b4
to
a77527f
Compare
@senny, I've added additional logic so that the rename column suggestion is only output when it's actually a column in conflict. |
a77527f
to
7d7c9ff
Compare
I don't think we should add logic to this warning. We can come up with a more generic message? Something like:
|
I'm with @rafaelfranca on this one. A generic message that gives hints to what could be the cause is fine but I'd rather not add any logic. At the point where this warning is raised the mistake has already been made. What would be nice is a warning when running migrations that add colliding columns. Would be a bigger change though. |
@rafaelfranca @senny Good points. I'll make the changes for @rafaelfranca suggestion. |
7d7c9ff
to
5454408
Compare
@rafaelfranca Updated with clearer messaging and logic removed. |
Could you squash your commits? |
…aging that the conflict could be because of a conflicting attribute.
5454408
to
53e753b
Compare
Squashed. |
…r_message Improved the error messaging for the DangerousAttributeError exception
Thanks |
…r_message Improved the error messaging for the DangerousAttributeError exception
When the DangerousAttributeError exception is thrown, it's not entirely clear where the conflict is originating from. Now the user is alerted that the conflict is a similarly named column.
I ran into this issue the other day when a column "valid" was added via a migration. I received the message:
By the looks of that message, I thought that I had created a method called valid? on my model (which wasn't the case). It took me a while to track down that a column named 'valid' had been added to the table via a migration.