ActiveRecord :: StatementInvalid: could not find user tables,

I am learning Ruby on Rails Tutorial, I finished chapter 7 and it works well, but stumbled upon 25 crashes / errors, such as:

User Error / error: @user = User.new (name: "User example", email: " user@example.com ", ActiveRecord :: StatementInvalid: Could not find table users. #. / Spec / models / user_spec.rb : 18: in new' # ./spec/models/user_spec.rb:18:in block (2 levels) in'

This is user_controller.rb

 class UsersController < ApplicationController def new @user = User.new end def show @user = User.find(params[:id]) end def create @user = User.new(params[:user]) if @user.save flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end end 

Thanks for your help.

+6
source share
1 answer

You can check if db/test.sqlite3 . In this case, run rake db:test:prepare

+26
source

Source: https://habr.com/ru/post/915587/


All Articles