Acts_as_taggable, v1.0.4 and v.2.0.2

Hi all,

After update to 2.0.2 version of acts_as_taggable plugin, I am having a
lot of exceptions during unit tests run, these exceptions look like the
following:

table not found: “credits_tags”

And that is right, since that table has different name in database, it’s
actually called “tags_credits”. I’ve fixed this by adding :join_table
declaration to model, but since I am not sure that is best solution I
decided to diff plugin code among its versions:

v1.0.4
default_join_table = “#{tag_model.table_name}_#{self.table_name}”

v2.0.2
if tag_model.table_name < self.table_name
default_join_table = “#{tag_model.table_name}#{self.table_name}"
else
default_join_table = "#{self.table_name}
#{tag_model.table_name}”
end

Confused a lot… I have no idea why someone needs that condition there,
is it helpful at all? Can you please advice?

Thanks for your help!
Pavel

in has_and_belong_to_many Relationships, rails assumes that the
jointable is named table1_table2, e.g. credits_tags, BUT it is a
convention that the alphabetically “lower” (my damn english) name
comes first.

So following rails conventions, it should be credits_tags, but
tags_waffels. That’s what this condition checks.

So it seems the new version of this plugin just tries to follow rails
convention, which is a good thing.

greets

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs