나는 처음부터 사용자 인증을 위해 개정 된 레일 스퀘어를 따라갔습니다.사용자 프로필을 처음부터 사용자 인증으로 업데이트하는 방법
성별, 민족성, 경력, 나, 어린이, 신장 등과 같은 등록 후에 입력해야하는 다른 입력란이 있으므로 프로필을 수정하기 위해 사용자를 추가 할 수있는 방법을 알고 싶습니다.
이 작업을 수행하는 방법을 보여주는 자습서가 있습니까? 아니면 누군가가 올바른 방향으로 나를 도와 줄 수 있습니까?
내 프로젝트 파일 https://github.com/pwz2k/date
UPDATE 나는이 권리를하고있는 중이 야 있는지 확실하지 않습니다, 그것은 작업을 시작했다
에서 볼 수 있습니다. 사용자가 계정 설정 (등록 할 때 사용하는 입력란)을 수정할 수있게하려고합니다.
다음은 /user 폴더에있는 내 edit.html입니다. 나는 결국 모든 것을 가지고 얼마나
def edit
@user = User.find(params[:user])
end
def update
@user = User.find(params[:user])
if @user.update_attributes(params[:user])
flash[:success] = "Account updated"
sign_in @user
redirect_to @user
else
render 'edit'
end
작업입니다 : 나는 내가 제대로 한 확실하지 오전 users_controller에 추가 여기에서
Dating::Application.routes.draw do
get 'signup' => 'users#new'
get 'login' => 'sessions#new'
get 'logout' => 'sessions#destroy'
get 'edit' => 'edit#edit'
resources :users
resources :sessions
resources :password_resets
root to: 'users#new'
된다 : 여기
<h1>Account Information</h1>
<%= form_for @user do |f| %>
<% if @user.errors.any? %>
<div class="error_messages">
<h2>Form is invalid</h2>
<ul>
<% @user.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :email %><br/>
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :password %><br/>
<%= f.password_field :password %>
</div>
<div class="field">
<%= f.label :password_confirmation %><br/>
<%= f.password_field :password_confirmation %>
</div>
<div class="field">
<%= f.label :username %><br/>
<%= f.text_field :username %>
</div>
<div class="field">
<%= f.label :zip_code %><br/>
<%= f.text_field :zip_code %>
</div>
<div class="field">
<%= f.label :birthday %><br/>
<%= f.text_field :birthday %>
</div>
<div class="actions"><%= f.submit %></div>
<% end %>
내 경로입니다 사용자는/편집 할 때 등록 과정에서 채워지는 모든 개인 정보로 계정 설정을 수정합니다. 그런 다음 사용자는 자신의 프로필 페이지에서 직접 프로필 정보 (성별, 인종, 경력, 나에 관한 것 등)를 편집 할 수 있습니다 (즉석 편집 사용). 그래서 나는 내가 취한 조치가 정확한지 (나는 아직 터미널을 사용하지 못했는지) 알 필요가있다. 그렇다면 라우팅 에러 atm을 보여 주면서 편집 페이지를 어떻게 표시 할 것인가?
수정 된 레일 스코어는 공개적으로 액세스 할 수 없으므로 일부 코드를 보여주십시오. 그 근거로 무언가를 제안 할 수 있습니다 – CuriousMind
모든 파일을 보여주기 위해 github 링크를 추가했습니다. 이것은 https://github.com/pwz2k/date에 도움이됩니다 –