mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-04 23:11:47 +01:00
store rendered notes of todos in database to avoid costly rendering when you load a page
This commit is contained in:
parent
f32e5b256b
commit
bb8b5a4c72
6 changed files with 81 additions and 27 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue