사용자 인증을 위해 Devise를 사용하는 Rails 앱이 있습니다. 나는 Devise 편집 사용자 기능이 이전에 작동했음을 확신하지만 어떤 이유로 편집/업데이트가 더 이상 작동하지 않습니다. '업데이트'를 클릭하면 페이지가 새로 고침됩니다. 모든 내용을 올바르게 입력 했음에도 "아래의 문제를 검토하십시오 :"라고 표시됩니다.Devise 사용자를 편집 할 수 없습니다.
취소 계정 기능은 완벽하게 작동합니다. 문제가 URL 경로 일 수 있습니까? 그렇다면 왜 계정을 취소해도 업데이트가되지 않습니까? 다른 모델에서 중첩 된 사용자 모델을 가지고 있지만 url 경로에 대한 변형을 시도했지만 어느 것도 작동하지 않았습니다.
다음은 고안 및 사용 simple_form에 의해 생성 된 양식 페이지입니다 :
.col-md-5.col-md-offset-2
%h2
Edit #{resource_name.to_s.humanize}
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name) , html: { method: :put }) do |f|
= f.error_notification
.form-inputs
= f.input :email, required: true, autofocus: true
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
%p
Currently waiting confirmation for: #{resource.unconfirmed_email}
= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false
= f.input :password_confirmation, required: false
= f.input :current_password, hint: "we need your current password to confirm your changes", required: true
.form-actions
= f.button :submit, "Update"
%h3 Cancel my account
%p
Unhappy? #{link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete}
= link_to "Back", root_path
업데이트 :
여기 development.log 파일에서 출력은 다음과 같습니다
Started PUT "/users" for 127.0.0.1 at 2014-12-14 00:05:07 -0500
Processing by Users::RegistrationsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Zhtv8rbmwIDuZO7Tv/0db7tSIGfGUEW56fqPKzkgQSo=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "current_password"=>"[FILTERED]"}, "commit"=>"Update"}
[1m[36mUser Load (0.3ms)[0m [1mSELECT `users`.* FROM `users` WHERE `users`.`id` = 16 ORDER BY `users`.`id` ASC LIMIT 1[0m
[1m[35mUser Load (0.2ms)[0m SELECT `users`.* FROM `users` WHERE `users`.`id` = 16 LIMIT 1
[1m[36m (0.2ms)[0m [1mBEGIN[0m
[1m[35m (0.1ms)[0m ROLLBACK
Rendered devise/registrations/edit.html.haml within layouts/application (4.3ms)
Rendered common/_login.html.haml (0.5ms)
Completed 200 OK in 328ms (Views: 175.1ms | ActiveRecord: 0.7ms)
가 여기 내 경로입니다. rb 파일. 두 번 나열된 사용자가 있습니다.
devise_for :users
root 'welcome#index'
resources :wedding_checklists do
resources :users
resources :checklist_items
end
오류가 발생하면'log/development.log' 파일을 확인하십시오. 행동이 조용히 실패하는 이유에 대한 자세한 내용이있을 수 있습니다. –
사용자가 Devise :: RegistrationsController를 사용자 정의한 것처럼 보입니다. Users : RegistrationsController # update – Hoa
감사합니다. 이 파일에 커스터마이징이 없었기 때문에 표준 경로로 다시 변경했습니다. 내 routes.rb로 질문을 업데이트하겠습니다. –