]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/diary_entry.rb
Merge remote-tracking branch 'upstream/pull/5735'
[rails.git] / app / models / diary_entry.rb
index e83dfb9ee47af81706161260781f7bb663a8fc88..ad9659438d71e6a0b176f8b649b8fed49161f896 100644 (file)
@@ -2,8 +2,8 @@
 #
 # Table name: diary_entries
 #
-#  id            :bigint(8)        not null, primary key
-#  user_id       :bigint(8)        not null
+#  id            :bigint           not null, primary key
+#  user_id       :bigint           not null
 #  title         :string           not null
 #  body          :text             not null
 #  created_at    :datetime         not null
@@ -50,7 +50,7 @@ class DiaryEntry < ApplicationRecord
   after_save :spam_check
 
   def body
-    RichText.new(self[:body_format], self[:body])
+    @body ||= RichText.new(self[:body_format], self[:body])
   end
 
   private