You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This maintains the deprecated associations behavior where singular associations can be referred to in where clauses by their plural name. Enable this configuration option to opt into the new behavior.
1050
-
1051
-
before,
1049
+
This enables deprecated behavior wherein singular associations can be referred to by their plural name in`where` clauses. Setting this to `false` is more performant.
1052
1050
1053
1051
```ruby
1054
-
class Post
1055
-
end
1056
-
1057
-
class Comment
1052
+
class Comment < ActiveRecord::Base
1058
1053
belongs_to :post
1059
1054
end
1060
1055
1061
-
post = Post.first
1062
-
Comment.where(posts: post) # deprecated
1063
-
Comment.where(post: post) # instead use the relation's name
1056
+
Comment.where(post: post_id).count # => 5
1057
+
1058
+
# When `allow_deprecated_singular_associations_name` is true:
0 commit comments