method
sanitize_as_sql_comment
rails latest stable - Class:
ActiveRecord::ConnectionAdapters::Quoting
sanitize_as_sql_comment(value)public
No documentation available.
# File activerecord/lib/active_record/connection_adapters/abstract/quoting.rb, line 167
def sanitize_as_sql_comment(value) # :nodoc:
# Sanitize a string to appear within a SQL comment
# For compatibility, this also surrounding "/*+", "/*", and "*/"
# charcacters, possibly with single surrounding space.
# Then follows that by replacing any internal "*/" or "/ *" with
# "* /" or "/ *"
comment = value.to_s.dup
comment.gsub!(%{\A\s*/\*\+?\s?|\s?\*/\s*\Z}, "")
comment.gsub!("*/", "* /")
comment.gsub!("/*", "/ *")
comment
end