我使用友好的id來允許用戶使用他們的登錄名稱訪問配置文件,但是當我嘗試註冊友好標識保留的登錄名時,出現錯誤。看來設計不能正確地呈現錯誤消息。當我使用authlogic時,錯誤正常工作。使用保留字時友好的id和設計錯誤
Friendly_id配置:
3210錯誤:
FriendlyId::ReservedError in Devise::RegistrationsController#create
FriendlyId::ReservedError
我使用:
gem 'devise', '1.3.4'
gem 'friendly_id', '3.2.1.1'
這可以縮短爲一個班輪 - error.add:name,* errors.delete(:friendly_id)如果錯誤[:friendly_id] .present?'如記錄[這裏](http://rubydoc.info/github/norman/friendly_id/master/FriendlyId/Reserved) – 2014-06-14 08:21:18
檢查這些值會將它們添加到錯誤數組中。在檢查它們是否存在之前,我添加了'if [email protected]? && @errors [:friendly_id] .present?' – heavysixer 2015-05-19 16:12:36