Commit 1a3609f95867593f354d42714423bf625994db06

Authored by Eugene Korbut
1 parent 4898c259
Exists in master and in 1 other branch production

Truncate long problem message, fixed #848

Showing 1 changed file with 5 additions and 0 deletions   Show diff stats
app/models/problem.rb
... ... @@ -42,6 +42,7 @@ class Problem
42 42 validates_presence_of :environment
43 43  
44 44 before_create :cache_app_attributes
  45 + before_save :truncate_message
45 46  
46 47 scope :resolved, ->{ where(:resolved => true) }
47 48 scope :unresolved, ->{ where(:resolved => false) }
... ... @@ -140,6 +141,10 @@ class Problem
140 141 end
141 142 end
142 143  
  144 + def truncate_message
  145 + self.message = self.message[0, 1000] if self.message
  146 + end
  147 +
143 148 def remove_cached_notice_attributes(notice)
144 149 update_attributes!(
145 150 :messages => attribute_count_descrease(:messages, notice.message),
... ...