method

annotate

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: ActiveRecord::QueryMethods
annotate(*args) public

Adds an SQL comment to queries generated from this relation. For example:

User.annotate("selecting user names").select(:name)
# SELECT "users"."name" FROM "users" /* selecting user names */

User.annotate("selecting", "user", "names").select(:name)
# SELECT "users"."name" FROM "users" /* selecting */ /* user */ /* names */

The SQL block comment delimiters, “/*” and “*/”, will be added automatically.

Some escaping is performed, however untrusted user input should not be used.

Show source
Register or log in to add new notes.