method
annotate
v7.2.3 -
Show latest stable
- 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.