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
Symbol-type class_names in associations doesn't work #1363
Comments
This is a long running issue. I can tell that it exists since 2.x.x. I'll have a look into it. |
"I think it's Rails-style to make both string and symbolic types acceptable." No, it is not. This is common on some hashes due to security reasons, but it is not a general style. |
@josevalim what is the general style regarding hash keys? |
I haven't noticed this and reported a similar issue (#2530) again. At least it needs to be documented somewhere. |
It is more natural to pass class names as strings, especially when the class name is namespaced.
|
@yfeldblum why? |
It is more natural for the programmer to write
than for him to write
or some variant thereof. |
I would write |
|
I've two models:
Such code in controller:
causes an error message:
undefined method
match' for :user:Symbolbut simplу changing
:class_name => 'User'` solves the issue. I think it's Rails-style to make both string and symbolic types acceptable.The text was updated successfully, but these errors were encountered: