Help us understand the problem. What is going on with this article?

deviseで確認パスワードを入れずに新規登録する方法

More than 5 years have passed since last update.

デフォルトではpasswordpassword_confirmationの入力が必須です。
そこで、password_confirmationなしでの登録方法です。


model/user.rb
class User < ActiveRecord::Base
   attr_accessible :email, :password, :password_confirmation, :remember_me
end

とデフォルトではなっています。ここで、:password_confirmationを削除します。

views/registrations/new.html.erb
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>

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

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

  <div><%= f.label :email %><br />
  <%= f.email_field :email %></div>

  <div><%= f.label :password %><br />
  <%= f.password_field :password %></div>

  <div><%= f.label :password_confirmation %><br />
  <%= f.password_field :password_confirmation %></div>

  <div><%= f.submit "登録する" %></div>

<% end %>

ここでは、f.label :password_confirmationf.password_field :password_confirmationを削除します。

これで確認パスワードなしで新規登録することができます。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした