当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby on rails - How can I use awesome_nested_set or another nested set gem to indicate synonyms?

问题描述:

I have a tagging system using awesome_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!

分享给朋友:
您可能感兴趣的文章:
随机阅读: