store rendered notes of todos in database to avoid costly rendering when you load a page

This commit is contained in:
Reinier Balt 2012-04-12 11:34:08 +02:00
parent f52f0e89d0
commit 1eea06052e
6 changed files with 81 additions and 27 deletions

View file

@ -1,5 +1,6 @@
class Todo < ActiveRecord::Base
before_save :render_note
after_save :save_predecessors
# relations
@ -392,4 +393,12 @@ class Todo < ActiveRecord::Base
return todo
end
def render_note
unless notes.nil?
rendered_notes = Tracks::Utils.render_text(notes)
else
rendered_notes = nil
end
end
end