2014-12-09 2 views
0

나는 사용자 모델 및 프로파일 모델을 작동시키기 위해 사용하는보기가 있습니다! 사용자 및 프로파일을 업데이트하는 사용자 정의보기

<h2>Edit</h2> 

<%= form_for(@profile) do |f| %> 

    <% if @profile.errors.any? %> 
    <div id="error_explanation"> 
     <h2><%= pluralize(@profile.errors.count, "error") %> prohibited this profile from being saved:</h2> 
     <ul> 
     <% @profile.errors.full_messages.each do |msg| %> 
      <li><%= msg %></li> 
     <% end %> 
     </ul> 
    </div> 
    <% end %> 

    <%= fields_for @profile.user do |u| %> 
    <div><%= u.label :email %><br /> 
     <%= u.email_field :email, autofocus: true %> 
    </div> 
    <% end %> 

    <div><%= f.label :alias %><br /> 
    <%= f.text_field :alias %> 
    </div> 

    <div> 
    <%= f.label :sex %><br /> 
    <%= f.select :sex, gender_options %> 
    </div> 

    <div><%= f.label :dob %><br /> 
    <%= f.date_select :dob, order: [:day, :month, :year], start_year: Date.today.year -100 %> 
    </div> 


    <div><%= f.submit "Update" %></div> 
<% end %> 

은 자신의 이메일 주소를 업데이트 할 수있게합니다 내가 reconfirmable 사용하고로 다음 이메일이 제대로 이메일 주소의 변경 사항을 확인하기 위해 사용자에게 전송됩니다.

<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 
<%= devise_error_messages! %> 

내가 좋아하는 것 :

<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 
    <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> 
    <% end %> 

원래 유증의 형태는 다음과 같은 형식의 헤더가 포함 된 이메일 확인이 계류중인 경우

원래 유증 뷰는 사용자에게 알려 다음을 포함 이러한 형식의 기능을 내 양식에 통합 할 수 있지만 form_for와 반대되는 내 "전자 메일"필드에 대해 fields_for를 사용할 때 어디서 어떻게 포함해야하는지 확신 할 수 없습니다. 아래의 코드에서

답변

0

, @profile.user

<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 
    <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> 
<% end %> 
resource으로 대체
관련 문제