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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

0回答

778閲覧

deviseで登録情報がsaveできない

waiwa

総合スコア0

Devise

Deviseとは、Ruby-on-Railsの認証機能を追加するプラグインです。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2020/09/30 04:57

編集2020/10/01 05:49

前提・実現したいこと

現在、rubyを使って、プラットフォームアプリを作成しています。
deviseを導入して、複数モデルを作成し、ログインを実行したところ
保存がされていませんでした。通常通りログインができるようにしたいです。
初学者ゆえ、もろもろ抜けているところなどありましたら、ご指摘いただければと思います。

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

ターミナル Started POST "/speakers" for ::1 at 2020-10-01 14:33:00 +0900 Processing by Speakers::RegistrationsController#create as HTML Parameters: {"authenticity_token"=>"cMpj1qCQPUrcY8s44bXNgiKuqAIsaUdlQThsr0H4h63nFNKe+8+r6dMc5ewH/vLk5iIJxh1vj86UWztsmmKRVg==", "speaker"=>{"nickname"=>"wa", "email"=>"wa@wa", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "first_name"=>"あ", "last_name"=>"あ", "first_name_kana"=>"ア", "last_name_kana"=>"ア", "birth_date(1i)"=>"1931", "birth_date(2i)"=>"6", "birth_date(3i)"=>"5"}, "commit"=>"会員登録"} From: /Users/yuuri/projects/wacca/app/controllers/speakers/registrations_controller.rb:15 Speakers::RegistrationsController#create: 13: def create 14: @speaker = Speaker.new(speaker_signup_params) => 15: binding.pry 16: if @speaker.save 17: redirect_to root_path 18: else 19: render :new 20: end 21: end [1] pry(#<Speakers::RegistrationsController>)> @speaker => #<Speaker id: nil, first_name: nil, last_name: nil, first_name_kana: nil, last_name_kana: nil, nickname: "", email: "", birth_date: nil, created_at: nil, updated_at: nil> [2] pry(#<Speakers::RegistrationsController>)>
コントローラー # frozen_string_literal: true class Speakers::RegistrationsController < Devise::RegistrationsController before_action :speaker_signup_params, only: [:create] # before_action :configure_account_update_params, only: [:update] # GET /resource/sign_up def new @speaker = Speaker.new end # POST /resource def create @speaker = Speaker.new(speaker_signup_params) if @speaker.save redirect_to root_path else render :new end end # GET /resource/edit # def edit # super # end # PUT /resource # def update # super # end # DELETE /resource # def destroy # super # end # GET /resource/cancel # Forces the session data which is usually expired after sign # in to be expired now. This is useful if the user wants to # cancel oauth signing in/up in the middle of the process, # removing all OAuth session data. # def cancel # super # end protected # If you have extra params to permit, append them to the sanitizer. def speaker_signup_params devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name,:last_name,:first_name_kana,:last_name_kana,:email,:nickname,:birth_date]) end # If you have extra params to permit, append them to the sanitizer. # def configure_account_update_params # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) # end # The path used after sign up. # def after_sign_up_path_for(resource) # super(resource) # end # The path used after sign up for inactive accounts. # def after_inactive_sign_up_path_for(resource) # super(resource) # end end

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問