Open amirali-ashraf opened 3 years ago
I have decided to use the table's id instead and I have another issue in front. UUID does not work for me since it returns 0 for id instead of the intended UUID. I am using MySQL and using uuid as the type also did not help os I changed it to:
t.references :taggable, polymorphic: true, type: :string
t.references :tagger, polymorphic: true, type: :string
I have the same problem. is it possible to make the taggable_id a string and have the model id work for both bigint and UUID?
I try this code.
User.joins("INNER JOIN taggings ON taggings.taggable_id = CAST(posts.id AS VARCHAR) AND taggings.taggable_type = 'User'")
.joins("INNER JOIN tags ON tags.id = taggings.tag_id")
.where(taggings: { context: "tags" })
.where(tags: { name: "test_tag_name" })
I would like to know how to move but cleanly solve the problem.
My team currently has this overall issue - we are building some new data models which will use uuid
as a primary key, however our existing acts-as-taggable-on
implementation has millions of rows of data for the historical models which all used bigint
.
I want to tag a model that does not have any field called id instead I am going to use another field that is used as id in my table called customerNumber. I want to know if there is any way to override the id with another field to store it in the tagging table.