-
Notifications
You must be signed in to change notification settings - Fork 351
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
Automatically pick up presence validators for default belongs_to association #654
Conversation
…ven ID attribute.
010df71
to
7b9c014
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great find, and a nice solution. I'm hoping it's not too hard to make it more general, for when the foreign key column name doesn't match Rails' conventions.
It would be nice to see a test to show what the new code does.
I'll do at least an entry in the README to see what the code does. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't merge this in case you want to do the README in this PR. Otherwise, you can merge this and do another PR.
Hey good people! I added the fully generalized version and added a section in the README displaying the resulting code. Please have a look. Squash and merge if it looks good. |
Oh, wait! One more fix needed! |
Now, go! |
Automatically pick up presence validators for an association for a given ID attribute.
This enables form validation with messages for default
belongs_to
associations since Rails 5.