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

acts_as_taggable and acts_as_ordered_taggable clobber each other #290

Open
pjungwir opened this issue Oct 7, 2012 · 2 comments
Open

acts_as_taggable and acts_as_ordered_taggable clobber each other #290

pjungwir opened this issue Oct 7, 2012 · 2 comments

Comments

@pjungwir
Copy link

pjungwir commented Oct 7, 2012

Each time you use acts_as_taggable or acts_as_ordered_taggable in your class, core.rb redefines the methods for all the tag types, including ones already defined from a previous acts_as_taggable or acts_as_ordered_taggable line.

You can test this by adding a puts to core.rb:

def initialize_acts_as_taggable_on_core
    tag_types.map(&:to_s).each do |tags_type|
      puts "----------------------------------------#{tags_type} (#{preserve_tag_order?})----------------------"
      tag_type         = tags_type.to_s.singularize
      # . . .

Now suppose you define your model like so:

class Foo
  acts_as_taggable_on :skills
  acts_as_ordered_taggable_on :books, :music
  acts_as_taggable_on :interests
  # . . .

When Foo loads, you see this printed:

----------------------------------------skills (false)----------------------
----------------------------------------skills (false)----------------------
----------------------------------------books (true)----------------------
----------------------------------------music (true)----------------------
----------------------------------------skills (false)----------------------
----------------------------------------books (false)----------------------
----------------------------------------music (false)----------------------
----------------------------------------interests (false)----------------------

This means that you can't mix ordered and unordered tag types in the same class. Whatever kind of tag type you define last sets the ordered property for all previously-defined tag types.

@shekibobo
Copy link
Contributor

This may be related to #339. Could you check your test again against this PR?

@tilsammans
Copy link
Contributor

#339 was just merged into master, so you can use master branch for testing.

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

No branches or pull requests

3 participants