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
ActiveRecord crashes when having an association called "association" #2704
Comments
|
Wouldn't |
|
Seems not. I try to upgrade an application to use rails 3.1 and it has an association with this name. To find the bug costs some time so it would be great if rails tells the user that it is a reserved word, this would save a lot of time, I think. |
|
There is an instance method association for every ActiveRecord object defined here : So yes, in 3.1, the word association is reserved. |
|
Would be great, if rails warns me if I define an association called "association" |
|
Spent 2 days debugging the same issue. |
|
@spieker sounds very handy. @rafaelfranca what do you think of a PR for this? |
|
I think that would be great. Let try to fix it. |
|
I'm a teacher. The second rails app I made, I tried to name a model "Class". Made sense to me at the time. Didn't work. Didn't file a bug report, either. Filed it away under "things learned about Rails." |
|
What is the status on this? Has the issue been fixed via another PR? Having reserved keywords raise errors would be ideal, while it might make sense after the fact debugging the first time you run into the problem can be tricky. Tracking this in code would be a good way to clarify if scenarios like this were reserved keywords are added in fully realized this side effect. |
|
I don't think anything has been merged lately related to this no. In any case, it seems hard to handle every possibility, since you're technically not supposed to override any of the methods in Btw, I know that scopes when created were doing this check, not sure they still do that in master (haven't checked again). |
|
This is essentially a feature request. I'd love to have some specific cases merged, but it'll be near impossible to get perfect, and so I'm closing this. If you'd like to improve this aspect of rails, please submit a pull request: @schneems has improved several error messages lately. Thanks. |
Having an association called "association" on an ActiveRecord model results in a "SystemStackError: stack level too deep" exception. Using WEBrick this results in an "Illegal instruction"
The text was updated successfully, but these errors were encountered: