Module: Katello::Concerns::AuditCommentExtensions::ClassMethods

Defined in:
app/models/katello/concerns/audit_comment_extensions.rb

Instance Method Summary collapse

Instance Method Details

#truncate_audit_comment(long_comment) ⇒ Object

to prevent PG::StringDataRightTruncation: ERROR: value too long for type character varying(255)



7
8
9
10
11
12
13
14
# File 'app/models/katello/concerns/audit_comment_extensions.rb', line 7

def truncate_audit_comment(long_comment)
  if long_comment.length > 255
    Rails.logger.info "Truncating audit comment: #{long_comment}"
    "#{long_comment[0..250]}..."
  else
    long_comment
  end
end