Mongoid::Errors::DocumentNotFound in SessionsController#create
アドレスとパスワードを入力してログインボタンを押したところ以下のようなエラーがでます。
2行目にエラーがでてます
エラーの内容がわかるかたお願いします。
message: Document not found for class User with attributes {:email=>"kanrip@example.org"}. summary: When calling User.find_by with a hash of attributes, all attributes provided must match a document in the database or this error will be raised. resolution: Search for attributes that are in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error.
RUBY
1def create 2 user = User.find_by(email: params[:session][:email].downcase) 3 if user && user.authenticate(params[:session][:password]) 4 log_in user 5 redirect_to user 6 else 7 flash.now[:danger] = 'Invalid email/password combination' 8 render 'new' 9 end 10end
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。