Domanda

Working on another deployment & found that rails generate friendly_id (as recommended by the Friendly_Id Documentation creates a new table called friendly_id_slugs - is this right or legacy?

È stato utile?

Soluzione

From the documentation:

FriendlyId's History module adds the ability to store a log of a model's slugs, so that when its friendly id changes, it's still possible to perform finds by the old id.

The primary use case for this is avoiding broken URLs.


Setup

In order to use this module, you must add a table to your database schema to store the slug records. FriendlyId provides a generator for this purpose:

rails generate friendly_id rake db:migrate This will add a table named friendly_id_slugs, used by the FriendlyId::Slug model.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top