module ActiveRecord::Comments
Constants
- VERSION
Public Class Methods
Source
# File lib/active_record/comments.rb, line 14 def comment(comment) current_comments << comment yield ensure current_comments.pop end
Source
# File lib/active_record/comments.rb, line 35 def current_comment current_comments.join(" ") if current_comments.present? end
Source
# File lib/active_record/comments.rb, line 31 def current_comments Thread.current[:ar_comments] ||= [] end
Source
# File lib/active_record/comments.rb, line 10 def prepend=prepend @@prepend = prepend end
Source
# File lib/active_record/comments.rb, line 21 def with_comment_sql(sql) return sql unless comment = current_comment if @@prepend == true "/* #{comment} */ #{sql}" else "#{sql} /* #{comment} */" end end