Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated Changelog and regenerated Guide

  • Loading branch information...
commit 4c0781b212a8b249ce92bd60c6fd575c8bb5cb39 1 parent d690c33
@norman authored
Showing with 18 additions and 0 deletions.
  1. +1 −0  Changelog.md
  2. +17 −0 Guide.rdoc
View
1  Changelog.md
@@ -10,6 +10,7 @@ suggestions, ideas and improvements to FriendlyId.
* Improved conflict handling and performance in History module (Erik Ogan and Thomas Shafer)
* Fixed bug that impeded using underscores as a sequence separator (Erik Ogan and Thomas Shafer)
+* Minor documentation improvements (Norman Clarke)
## 4.0.1 (2012-02-29)
View
17 Guide.rdoc
@@ -475,4 +475,21 @@ FriendlyId.defaults}:
config.use :reserved
# Reserve words for English and Spanish URLs
config.reserved_words = %w(new edit nueva nuevo editar)
+ end
+
+Note that the error message will appear on the field +:friendly_id+. If you are
+using Rails's scaffolded form errors display, then it will have no field to
+highlight. If you'd like to change this so that scaffolding works as expected,
+one way to accomplish this is to move the error message to a different field.
+For example:
+
+ class Person < ActiveRecord::Base
+ extend FriendlyId
+ friendly_id :name, use: :slugged
+
+ after_validation :move_friendly_id_error_to_name
+
+ def move_friendly_id_error_to_name
+ errors.messages[:name] = errors.messages.delete(:friendly_id)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.