質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.45%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

0回答

284閲覧

新規のユーザー登録ができない

naiban

総合スコア0

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/08/05 13:57

前提・実現したいこと

以前までは新規のユーザーの作成ができていたのですが、デザインなどを付けた後正常に新規のユーザー登録が行われなくなりました

発生している問題・エラーメッセージ

新規登録画面で「名前・アドレス・パスワード」を登録して「登録」というボタンを押してもsaveされません。その際にコマンドプロンプト内でも動きがなく、エラー文も出てきません。
一度パソコン自体も落として再度立ち上げたのですがやはり治りません。

エラーメッセージ

app/views/users/registraions/new.html.erb

app/views/users/registraions/new.html.erb

1<div class="body3"> 2 3 <header> 4 <h1>新規登録画面</h1> 5 <div class="header-list"> 6 <ul> 7 <li><%= link_to "ログイン画面へ", user_session_path %></li> 8 </ul> 9 </div> 10 </header> 11 12 <div class="row"> 13 <div class="col-md-1"> 14 15 </div> 16 <div class="size_test4"> 17 <div class="col-md-10"> 18 <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 19 <%= render "users/shared/error_messages", resource: resource %> 20 21 <div class="field5"> 22 <%= f.label :名前 %><br /> 23 <%= f.text_field :name, autofocus: true %> 24 </div> 25 26 <div class="field6"> 27 <%= f.label :メールアドレス %><br /> 28 <%= f.email_field :email, autofocus: true, autocomplete: "email" %> 29 </div> 30 31 <div class="field7"> 32 <%= f.label :パスワード %> 33 <% if @minimum_password_length %> 34 35 <br /> 36 <%= f.password_field :password, autocomplete: "new-password" %> 37 <% end %> 38 </div> 39 40 <div class="field8"> 41 <%= f.label :再パスワード %><br /> 42 <%= f.password_field :password_confirmation, autocomplete: "new-password" %> 43 </div> 44 </div> 45 46 <div class="actions"> 47 <%= f.submit "登録" %> 48 </div> 49 <% end %> 50 </div> 51 52 </div> 53</div> 54

###app/controllers/user_controller.rb

app/controllers/user_controller.rb

1class UsersController < ApplicationController 2 3 def index 4 @users=User.all 5 end 6 7 def show 8 @user = User.find(params[:id]) 9 @legends = Legend.all 10 @currentUserEntry=Entry.where(user_id: current_user.id) 11 @userEntry=Entry.where(user_id: @user.id) 12 if @user.id == current_user.id 13 else 14 @currentUserEntry.each do |cu| 15 @userEntry.each do |u| 16 if cu.room_id == u.room_id then 17 @isRoom = true 18 @roomId = cu.room_id 19 end 20 end 21 end 22 if @isRoom 23 else 24 @room = Room.new 25 @entry = Entry.new 26 end 27 end 28 end 29end 30

migrate

migrate

1# frozen_string_literal: true 2 3class DeviseCreateUsers < ActiveRecord::Migration[6.1] 4 def change 5 create_table :users do |t| 6 ## Database authenticatable 7 t.string :email, null: false, default: "" 8 t.string :encrypted_password, null: false, default: "" 9 10 ## Recoverable 11 t.string :reset_password_token 12 t.datetime :reset_password_sent_at 13 14 ## Rememberable 15 t.datetime :remember_created_at 16 17 ## Trackable 18 # t.integer :sign_in_count, default: 0, null: false 19 # t.datetime :current_sign_in_at 20 # t.datetime :last_sign_in_at 21 # t.string :current_sign_in_ip 22 # t.string :last_sign_in_ip 23 24 ## Confirmable 25 # t.string :confirmation_token 26 # t.datetime :confirmed_at 27 # t.datetime :confirmation_sent_at 28 # t.string :unconfirmed_email # Only if using reconfirmable 29 30 ## Lockable 31 # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 # t.string :unlock_token # Only if unlock strategy is :email or :both 33 # t.datetime :locked_at 34 35 36 t.timestamps null: false 37 end 38 39 add_index :users, :email, unique: true 40 add_index :users, :reset_password_token, unique: true 41 # add_index :users, :confirmation_token, unique: true 42 # add_index :users, :unlock_token, unique: true 43 end 44end 45

試したこと

デザインを付け加えた後にエラーが出たので、一度デザインを削除しましたが、やはりだめでした。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

anozon

2021/08/05 14:56

DevTools で console にエラーは出ていますか? DevTools のNetwork タブで通信・リクエストが発生しているのは確認できますか?
winterboum

2021/08/05 22:54

url: registration_path(resource_name)) ここのcodeを載せて
Kahoo

2021/08/08 04:29

Deviseのregistrations_controllerを変更されていたらそれも拝見したいです。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.45%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問