Module: ActiveRecord::Comments

Defined in:
lib/active_record/comments.rb,
lib/active_record/comments/version.rb,
lib/active_record/comments/execute_with_comments.rb

Defined Under Namespace

Modules: ExecuteWithComments

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.comment(comment) ⇒ Object



8
9
10
11
12
13
# File 'lib/active_record/comments.rb', line 8

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

.with_comment_sql(sql) ⇒ Object



15
16
17
18
# File 'lib/active_record/comments.rb', line 15

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