Preserve the order in which tags are created #173

Closed
wants to merge 1 commit into
from

Projects

None yet

4 participants

Contributor

This commit adds acts_as_ordered_taggable methods to use when you want to preserve the order in which tags are created.

For example, using the new methods means that when an object's tag_list is updated from [4,5,6] to [3,6,9] a subsequent fetch of the object's tag_list will return [3,6,9] and also the tags association will return tag objects in the same order.

The new methods set the attribute preserve_tag_order? to true and consequently (1) when saving tags, the taggings are created in the order in which the tags appear in the tag list; (2) when fetching tags by context for the tag lists they are ordered by tagging created_at; (3) an order option is added to the tag context associations (so that for a 'tags' context the associations tag_taggings & tags are always returned in tagging created_at order)

@chrismhilton chrismhilton Added acts_as_ordered_taggable to preserve the order in which tags ar…
…e created

The new methods set the attribute preserve_tag_order? to true and
consequently (1) when saving tags, the taggings are created in the order
in which the tags appear in the tag list; (2) when fetching tags by
context for the tag lists they are ordered by tagging created_at; (3) an
order option is added to the tag context associations (so that for a
'tags' context the associations tag_taggings & tags are always returned
in tagging created_at order)
6feaed2

+1

Collaborator
artemk commented Dec 16, 2011

@chrismhilton can you update your patch will latest changes in gem?

@artemk artemk closed this Dec 18, 2011

+1

Contributor

I have now re-forked the latest version of the repo & re-created my commit and created a new pull request #236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment