ユーザーが状況に応じてアカウントの有無にかかわらずいくつかの詳細を変更できるように、少し工夫したgemをオーバーライドしました。
jQuery検証プラグインを使用しているため、deviseエラーメッセージを使用したくありません。
何らかのデバイスエラーが発生した場合に通知エラーを表示したいのですが、flash[:error] を配置する場所がわかりません。
ここに私の更新アクションがあります:
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
# custom logic
if params[:user][:password].present?
result = resource.update_with_password(params[resource_name])
else
result = resource.update_without_password(params[resource_name])
end
# standart devise behaviour
if result
if is_navigational_format?
if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?
flash_key = :update_needs_confirmation
end
set_flash_message :notice, flash_key || :updated
end
sign_in resource_name, resource, :bypass => true
respond_with resource, :location => after_update_path_for(resource)
else
if params[:user][:password].present?
clean_up_passwords resource
render "edit_user/edit_password"
end
end
それで、誰かがこれで私を助けることができますか?