Skip to content

Improve ActiveRecord::QueryMethods#includes docs #11479

Merged
merged 1 commit into from Jul 17, 2013

2 participants

@henrikhodne

It's not immediately clear whether you can pass in multiple relations or not (or at least, it wasn't clear to me). After going through the code a bit, I saw that the arguments are just appended to an array.

@senny
Ruby on Rails member
senny commented Jul 17, 2013

You can also add an example with a Hash argument to preload nested associations.

@henrikhodne

Like this?

User.includes(:address, friends: :address)
@senny
Ruby on Rails member
senny commented Jul 17, 2013

let's add an array to the mix:

User.includes(:adress, friends: [:adress, :followers])
@senny
Ruby on Rails member
senny commented Jul 17, 2013

@henrikhodne looks good. Can you add [ci skip] to the commit message and squash the two commits together?

@henrikhodne henrikhodne Improve ActiveRecord::QueryMethods#includes docs
It's not immediately clear whether you can pass in multiple relations or
not. After going through the code a bit, I saw that the arguments are
just appended to an array. Also, added nested relations example.

[ci skip]
ef350c9
@henrikhodne

@senny Squashed and pushed. Sorry for not adding the CI skip message in the first two commits.

@senny
Ruby on Rails member
senny commented Jul 17, 2013

no worries. Thanks for your contribution 💛

@senny senny merged commit 5245648 into rails:master Jul 17, 2013
@henrikhodne henrikhodne deleted the henrikhodne:improve-ar-querymethods-includes-docs branch Jul 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.