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 f32e5b256b
commit bb8b5a4c72
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
# associations
@ -396,4 +397,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