Flowdock
method

references

Importance_1
references(*args) public

Used to indicate that an association is referenced by an SQL string, and should therefore be JOINed in any query rather than loaded separately.

User.includes(:posts).where("posts.name = 'foo'")
# => Doesn't JOIN the posts table, resulting in an error.

User.includes(:posts).where("posts.name = 'foo'").references(:posts)
# => Query now knows the string references posts, so adds a JOIN
Show source
Register or log in to add new notes.