[英]Devise with rails 4 not updating user
我將應用程序升級到rails 4,一切正常。 我可以登錄並轉到我的編輯頁面。 還更新了視圖。 使用標准視圖時,用戶會更新。 但是當我添加例如字段:name時,它不會在表單中更新。
使用設計3.1.1以及gem'en protected_attributes'
我需要在devise或db上運行某種更新命令嗎?
我也搜索了這個地方,找到了許多不同的解決方案,但沒有人會更新我的用戶字段。 我沒有添加任何自定義字段。
如果要允許其他參數,可以在ApplicationController
使用before filter
,因為Rails 4將參數清理從模型移動到控制器。
class ApplicationController < ActionController::Base
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) << :name << :surname << :username
devise_parameter_sanitizer.for(:account_update) << :name << :surname << :username
end
end
你也可以在這里找到更多。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.