1
/users/edit 페이지가 아닌/settings 페이지에서 사용자가 자신의 이메일/비밀번호/이미지를 편집 할 수있는 옵션을 추가하고 싶습니다. 그래서 설정 페이지외부 사용자 정보 업데이트
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="form-group">
<%= f.label :image %>
<%= f.file_field :image, class: 'form-control'%>
</div>
<div class="form-group">
<%= f.label :cover %>
<%= f.file_field :cover, class: 'form-control'%>
</div>
<div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>
<div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password, autocomplete: "off" %>
</div>
<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>
<h3>Cancel my account</h3>
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
<%= link_to "Back", :back %>
에 코드를 복사하지만이
undefined local variable or method `resource' for #<#<Class:0x007f60245ab9b0>:0x007f6026f58358>
내 컨트롤러에 무엇을 추가해야 반환?
# <# : 0x007fb488d4e290>에 대해 '정의되지 않은 지역 변수 또는 메소드'resource'을 여전히 반환합니다. 첫째, 반환 된 정의되지 않은 사용자 그래서 나는 현재 사용자로 교체, 다음과 같은 오류가 발생했습니다 –
http://stackoverflow.com/a/6393151/5738789 답변입니다 –