문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top