mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Make sure that changing tags (i.e. toggle star) touches the taggable (todo) to invalidate cache. Make sure _context is cached different for _context of active todos and _context of tagged todos and _context in tickler
This commit is contained in:
parent
fb6ee29f43
commit
ff06f418e8
3 changed files with 4 additions and 3 deletions
|
@ -6,7 +6,7 @@ class Tagging < ActiveRecord::Base
|
|||
attr_accessible :taggable_id, :tag
|
||||
|
||||
belongs_to :tag
|
||||
belongs_to :taggable, :polymorphic => true
|
||||
belongs_to :taggable, :polymorphic => true, :touch => true
|
||||
|
||||
after_destroy :after_destroy
|
||||
|
||||
|
@ -16,4 +16,5 @@ class Tagging < ActiveRecord::Base
|
|||
def after_destroy
|
||||
tag.destroy if tag and tag.taggings.count == 0
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
@not_done = @not_done_todos.select {|t| t.context_id == context.id }
|
||||
cache context do
|
||||
cache [context, @source_view] do
|
||||
%>
|
||||
<div id="c<%= context.id %>" class="container context" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
|
||||
<h2>
|
||||
|
|
|
@ -64,7 +64,7 @@ module IsTaggable
|
|||
# Removes tags from <tt>self</tt>. Accepts a string of tagnames, an array of tagnames, or an array of Tags.
|
||||
def _remove_tags outgoing
|
||||
outgoing = tag_cast_to_string(outgoing)
|
||||
tags.delete(*(tags.select{|tag| outgoing.include? tag.name}))
|
||||
tags.destroy(*(tags.select{|tag| outgoing.include? tag.name}))
|
||||
end
|
||||
|
||||
def get_tag_name_from_item(item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue