Flowdock
method

annotate

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 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.