Skip to content

Instantly share code, notes, and snippets.

@potomak
Created May 2, 2014 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save potomak/d277af82e757a0619f41 to your computer and use it in GitHub Desktop.
Save potomak/d277af82e757a0619f41 to your computer and use it in GitHub Desktop.
Deprecation warning
DEPRECATION WARNING: It looks like you are eager loading table(s) (one of: contacts, additional_infos, groups, users) that are referenced in a string SQL snippet. For exa
mple:
Post.includes(:comments).where("comments.title = 'foo'")
Currently, Active Record recognizes the table in the string, and knows to JOIN the comments table to the query, rather than loading comments in a separate query. However,
doing this without writing a full-blown SQL parser is inherently flawed. Since we don't want to write an SQL parser, we are removing this functionality. From now on, you
must explicitly tell Active Record when you are referencing a table from a string:
Post.includes(:comments).where("comments.title = 'foo'").references(:comments)
If you don't rely on implicit join references you can disable the feature entirely by setting `config.active_record.disable_implicit_join_references = true`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment