Module: ActiveRecord::Comments

Defined in:
lib/active_record/comments.rb

Defined Under Namespace

Modules: ExecuteWithComments

Class Method Summary collapse

Class Method Details

.comment(comment) ⇒ Object


55
56
57
58
59
60
# File 'lib/active_record/comments.rb', line 55

def comment(comment)
  current_comments << comment
  yield
ensure
  current_comments.pop
end

.with_comment_sql(sql) ⇒ Object


62
63
64
65
# File 'lib/active_record/comments.rb', line 62

def with_comment_sql(sql)
  return sql unless comment = current_comment
  "#{sql} /* #{comment} */"
end