提交 0f8db212 编写于 作者: Z zino

[ci skip] Update doc for unnecessary #references

Update doc for #includes to clarify that #references is unnecessary when conditions are passed into #includes as a hash.
上级 ff7948b1
......@@ -100,7 +100,7 @@ def #{method_name}=(value) # def includes_values=(value)
#
# === conditions
#
# If you want to add conditions to your included models you'll have
# If you want to add string conditions to your included models, you'll have
# to explicitly reference them. For example:
#
# User.includes(:posts).where('posts.name = ?', 'example')
......@@ -111,6 +111,12 @@ def #{method_name}=(value) # def includes_values=(value)
#
# Note that #includes works with association names while #references needs
# the actual table name.
#
# If you pass the conditions via hash, you don't need to call #references
# explicitly, as #where references the tables for you. For example, this
# will work correctly:
#
# User.includes(:posts).where(posts: { name: 'example' })
def includes(*args)
check_if_method_has_arguments!(:includes, args)
spawn.includes!(*args)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册