module ActiveRecord::Comments

Constants

VERSION

Public Class Methods

comment(comment) { || ... } click to toggle source
# File lib/active_record/comments.rb, line 8
def comment(comment)
  current_comments << comment
  yield
ensure
  current_comments.pop
end
with_comment_sql(sql) click to toggle source
# File lib/active_record/comments.rb, line 15
def with_comment_sql(sql)
  return sql unless comment = current_comment
  "#{sql} /* #{comment} */"
end

Private Class Methods

current_comment() click to toggle source
# File lib/active_record/comments.rb, line 25
def current_comment
  current_comments.join(" ") if current_comments.present?
end
current_comments() click to toggle source
# File lib/active_record/comments.rb, line 21
def current_comments
  Thread.current[:ar_comments] ||= []
end