开发者

Is the slugs table required when using the friendly_id gem?

In the friendly_id gem docs it says to create a table slugs where all slugs are created. But in addition it gives me the opportunity to add a column to my model table to increase performance using cached_slugs.

My question is: Is the slug table neccessary even though I use the cached_开发者_运维技巧slugs column in my model table? Data would be redundant. I tried to delete my slugs table but then I got an error when creating a new entry in my database.


If you want to use slugs with friendly_id you have to use slugs table . In friendly_id Many slugs could reference same resource , slugs are not permalink , but only a seo friendly name . If you want something ligter than friendly_id i suggest to use stringex.

https://github.com/rsl/stringex

but , anyway , freindly_id work great and fast using cached_slug entry.

UPDATE:

The current version of friendly_id (4.0) does not require the slug table unless you're using the slug history option.

More info available here: http://rubydoc.info/github/norman/friendly_id/master/file/Guide.rdoc

Look under the Example Setup and History subheadings.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜