こんにちは。
【環境】
gem 'rails', '4.2.5'
devise (4.2.0)
【やりたいこと】
deviseを使った複数モデルでのsign_upの実装。
【現状】
以下の記事を参考にdeviseでモデルとコントローラーを作成しました。
http://qiita.com/Yama-to/items/54ab4ce08e126ef7dade
https://second-app-sagae.c9users.io/users/sign_upページで
sign upボタンを押すと
Email can't be blank
Password can't be blank
Username can't be blank
というエラー表示がでて先に進めません。
ちなみに、validationはusername以外はつけてません。
原因がわからなく大変困っております。
registrations_controller.rbのコードは以下です。
class Users::RegistrationsController < Devise::RegistrationsController before_action :configure_sign_up_params, only: [:create] #before_filter :configure_permitted_parameters, if: :devise_controller? # before_action :configure_account_update_params, only: [:update] # GET /resource/sign_up #def new #@user = User.new #end # POST /resource def create @user = User.new @user = User.new(configure_sign_up_params) if @user.save flash[:success] = "Welcome to the Sample App!" redirect_to @user 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 configure_sign_up_params devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) 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
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。