diff options
author | Kevin Deisz <kevin.deisz@gmail.com> | 2018-08-27 13:52:14 -0400 |
---|---|---|
committer | Kevin Deisz <kevin.deisz@gmail.com> | 2018-08-27 15:22:37 -0400 |
commit | 1c7275a0ba05aaa27e5999eaa10b698d890fa157 (patch) | |
tree | c8823e5ea69a613761c1dd44188fcd821e3389ed /activerecord/test/cases/collection_cache_key_test.rb | |
parent | 3218a662818a52bd20eb93ee5468e62bdc9ccdf6 (diff) | |
download | rails-1c7275a0ba05aaa27e5999eaa10b698d890fa157.tar.gz rails-1c7275a0ba05aaa27e5999eaa10b698d890fa157.tar.bz2 rails-1c7275a0ba05aaa27e5999eaa10b698d890fa157.zip |
Find inverse associations with plural names
Previously ActiveRecord couldn't find inverse associations if they were plural, which is a pretty standard use case. This commit changes the behavior to first attempt to find the singular version, then attempt to find the plural version. That makes it work and find plural associations as in the example below:
```
class Post
has_many :comments
end
class Comment
belongs_to :post
end
```
Previously the `:post` association reflection would only attempt to find a `comment` inverse, as opposed to both a `comment` and `comments` inverse.
Diffstat (limited to 'activerecord/test/cases/collection_cache_key_test.rb')
0 files changed, 0 insertions, 0 deletions