# FriendlyId 4 This is an in-progress rethink of the FriendlyId plugin. It will probably be released some time in August or September 2011, once I've had the chance to actually use it in a real website for a while. Please don't use this yet for anything real but feel free to try it and give your feedback via the issues tracker. ## Back to basics This isn't the "big rewrite," it's the "small rewrite." Adding new features with each release is not sustainable. This release *removes* features, but makes it possible to add them back as addons. We can also remove some complexity by relying on the better default functionality provided by newer versions of Active Support and Active Record. Let's see how small we can make this! Here's what's changed: ## Active Record 3+ only For 2.3 support, you can use FriendlyId 3, which will continue to be maintained until people don't want it any more. ## Remove Babosa Babosa is FriendlyId 3's slugging library. FriendlyId 4 doesn't use it by default any more because the most important pieces of it were already accepted into Active Support 3. You can still just override `#normalize_friendly_id` in your model if you want to use Babosa. ## In-table slugs FriendlyId no longer creates a separate slugs table - it just stores the generated slug value in the model table, which is simpler, faster and what most people seem to want. Keeping slugs in a separate table is an optional add-on for FriendlyId 4 (not implemented yet). ## No more finder status FriendlyId 3 offered finder statuses to help you determine when an outdated or non-friendly id was used to find the record, so that you could decide whether to permanently redirect to the canonical URL. However, there's a simpler way to do that, so this feature has been removed: if request.path != person_path(@person) return redirect_to @person, :status => :moved_permanently end ## No more multiple finds Person.find "joe-schmoe" # Supported Person.find ["joe-schmoe", "john-doe"] # No longer supported If you want find by more than one friendly id, build your own query: Person.where(:slug => ["joe-schmoe", "john-doe"]) This lets us do *far* less monkeypatching in Active Record. ## No more reserved words Rather than use a custom reserved words validator, use the validations provided by Active Record. FriendlyId still reserves "new" and "edit" by default to avoid routing problems. validates_exclusion_of :name, :in => ["bad", "word"] You can configure the default words reserved by FriendlyId in `FriendlyId::Configuration::DEFAULTS[:reserved_words]`.