Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve the order in which tags are created #236

Merged
merged 1 commit into from Mar 25, 2012

Conversation

chrismhilton
Copy link
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)

…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)
@aaronchi
Copy link

+1 I feel like this should be the default functionality

artemk added a commit that referenced this pull request Mar 25, 2012
Preserve the order in which tags are created
@artemk artemk merged commit 193f445 into mbleigh:master Mar 25, 2012
@artemk
Copy link
Collaborator

artemk commented Mar 25, 2012

@chrismhilton your pull request broke build http://travis-ci.org/#!/mbleigh/acts-as-taggable-on/builds/941712 . Please take a look and fix.

@chrismhilton
Copy link
Contributor Author

@artemk I have now fixed the build issues and will send through a further pull request

tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this pull request Mar 19, 2021
Preserve the order in which tags are created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants