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.
1035
-
1036
-
before,
1034
+
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.
1037
1035
1038
1036
```ruby
1039
-
class Post
1040
-
end
1041
-
1042
-
class Comment
1037
+
class Comment < ActiveRecord::Base
1043
1038
belongs_to :post
1044
1039
end
1045
1040
1046
-
post = Post.first
1047
-
Comment.where(posts: post) # deprecated
1048
-
Comment.where(post: post) # instead use the relation's name
1041
+
Comment.where(post: post_id).count # => 5
1042
+
1043
+
# When `allow_deprecated_singular_associations_name` is true:
0 commit comments