开发者

How can I use awesome_nested_set or another nested set gem to indicate synonyms?

开发者 https://www.devze.com 2023-02-19 20:34 出处:网络
I have a tagging system using awesom开发者_Python百科e_nested_set, which works great and lays out a nice hierarchy in the tags such that \"Customer Relationship Management\" is under \"Enterprise Reso

I have a tagging system using awesom开发者_Python百科e_nested_set, which works great and lays out a nice hierarchy in the tags such that "Customer Relationship Management" is under "Enterprise Resource Planning."

I'd like to include synonyms such that if someone adds the tag "CRM," I can recognize that "CRM" just means "Customer Relationship Management" and actually display the tag "Customer Relationship Management."

I would of thought that I can somehow mark a tag "CRM" as a synonym and any references to this tag will be redirected in "Customer Relationship Management"

Is it possible to do this with awesome_nested_set? Or is there another gem or method?

My only current thought is that I could make a flag for each item and then build a whole bunch of logic such that when I try to fetch a tag which is marked synonym, it instead returns the parent. Then I just have to mark "CRM" as a child of "Customer Relationship Management" and set as a synonym. But that seems incredibly inelegant.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号