Closed mizukami234 closed 6 years ago
@seuros I updated readme and changelog. Thank you for reviewing.
@mizukami234 do you mind squashing the commits ? The first commits are not linked to your account.
@seuros The first commits are actually not mine, added by @junmoka . They're not linked to him, but he said he didn't mind that.
I'm trying to implement this but I'm having problems with the models not using the correct table. this is what I have
# config/initializers/act_as_taggable_on.rb
ActsAsTaggableOn.tags_table = 'aato_tags'
ActsAsTaggableOn.taggings_table = 'aato_taggings'
When calling ActsAsTaggableOn.tags_table
on the rails console I'm getting the correct table name but when calling ActsAsTaggableOn::Tag.table_name
I'm getting :tags
I think the problem is that the models are loaded before the configuration is set.
How and when are you calling the ActsAsTaggableOn.tags_table = 'aato_tags'
?
I made this changes and it is now working for me. https://github.com/Adrian2112/acts-as-taggable-on/pull/1/files
I can make a PR if you think this is the way to fix it
Why hasn't Adrian2112's pull request already been merged into master? https://github.com/Adrian2112/acts-as-taggable-on/pull/1/files
This would have saved me hours and hours of debugging and digging into Activerecord's name guessing.
Until this is done, you can patch it through an initializer:
# config/initializers/act_as_taggable_on.rb
ActsAsTaggableOn::Configuration.class_eval do
def tags_table=(tags_table)
ActsAsTaggableOn::Tag.table_name = tags_table
@tags_table = tags_table
end
def taggings_table=(taggings_table)
ActsAsTaggableOn::Tagging.table_name = taggings_table
@taggings_table = taggings_table
end
end
ActsAsTaggableOn.tags_table = 'aato_tags'
ActsAsTaggableOn.taggings_table = 'aato_taggings'
@mrIllo because it on the wrong repo !
background & why
I'm working on a Rails project which has own
tags
table. In order to implement a new feature in my project, I need a new, independent tagging system, which AATO is suitable for. But I couldn't install it because duplicate table exists. So I forked this gem to make table names customizable.implementation
you can simply specify in config: