-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
customizable table names #910
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the readme and the changelog ?
@seuros |
@mizukami234 do you mind squashing the commits ? The first commits are not linked to your account. |
I'm trying to implement this but I'm having problems with the models not using the correct table. # config/initializers/act_as_taggable_on.rb
ActsAsTaggableOn.tags_table = 'aato_tags'
ActsAsTaggableOn.taggings_table = 'aato_taggings' When calling I think the problem is that the models are loaded before the configuration is set. I made this changes and it is now working for me. 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? 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: