Rails 4.2.10 Ruby 2.5.0
我无法进入巫术的注册页面,因为我收到了错误:
ActiveRecord :: StatementInvalid(Mysql2 ::错误:表' geofly_test.users'不存在:显示来自users
的完整字段):
app / controllers / users_controller.rb:29:在'new'
开发日志:
WelcomeController处理#index为HTML 渲染共享/ _login.html.erb(10.4ms) 在布局/应用程序中呈现welcome / index.html.erb(33.2ms) 在84ms完成200 OK(浏览次数:72.7ms | ActiveRecord:0.0ms)
开始GET" /assets/images/ajax-loader.gif"对于64.134.216.142在2018-03-24 22:13:50 +0000 无法从192.168.5.71渲染控制台!允许的网络:127.0.0.1,:: 1,127.0.0.0/127.255.255.255
开始使用HEAD" / users / new"对于104.51.164.9在2018-03-24 22:16:42 +0000 无法从104.51.164.9渲染控制台!允许的网络:127.0.0.1,:: 1,127.0.0.0/127.255.255.255 由UsersController处理#new为HTML 在105ms内完成500内部服务器错误(ActiveRecord:4.7ms)
ActiveRecord :: StatementInvalid(Mysql2 ::错误:表' geofly_test.users'不存在:显示来自users
的完整字段):
app / controllers / users_controller.rb:29:在'new'
我设置了config.web_console.whitelisted_ips =' 104.51.164.9',' 64.134.216.142',' 192.168.5.71'在development.rb
mysql显示users表和geofly_test数据库存在:
的MySQL>使用geofly_test
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_geofly_test |
+-----------------------+
| delayed_jobs |
| schema_migrations |
| users |
+-----------------------+
3行(0.00秒)
的database.yml
`cat schema.rb #encoding:UTF-8 #该文件是从数据库的当前状态自动生成的。代替 编辑此文件的#,请使用Active Record的迁移功能 #逐步修改数据库,然后重新生成此架构定义。 # #请注意,此schema.rb定义是您的权威来源 #database schema。如果需要在另一个上创建应用程序数据库 #system,您应该使用db:schema:load,而不是运行所有迁移 # 从头开始。后者是一种有缺陷且不可持续的方法(迁移越多 #你会积累,它运行的速度越慢,发生问题的可能性就越大。 # #强烈建议您将此文件检入您的版本控制系统。
ActiveRecord::Schema.define(version: 20150401095514) do
create_table "delayed_jobs", force: :cascade do |t|
t.integer "priority", limit: 4, default: 0, null: false
t.integer "attempts", limit: 4, default: 0, null: false
t.text "handler", limit: 65535, null: false
t.text "last_error", limit: 65535
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by", limit: 255
t.string "queue", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, null: false
t.string "crypted_password", limit: 255
t.string "salt", limit: 255
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "remember_me_token", limit: 255
t.datetime "remember_me_token_expires_at"
t.integer "failed_logins_count", limit: 4, default: 0
t.datetime "lock_expires_at"
t.string "unlock_token", limit: 255
t.datetime "last_login_at"
t.datetime "last_logout_at"
t.datetime "last_activity_at"
t.string "last_login_from_ip_address", limit: 255
t.string "activation_state", limit: 255
t.string "activation_token", limit: 255
t.datetime "activation_token_expires_at"
t.string "reset_password_token", limit: 255
t.datetime "reset_password_token_expires_at"
t.datetime "reset_password_email_sent_at"
end
add_index "users", ["activation_token"], name: "index_users_on_activation_token", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["last_logout_at", "last_activity_at"], name: "index_users_on_last_logout_at_and_last_activity_at", using: :btree
add_index "users", ["remember_me_token"], name: "index_users_on_remember_me_token", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", using: :btree
add_index "users", ["unlock_token"], name: "index_users_on_unlock_token", using: :btree
end
` cat config/database.yml
# MySQL.Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: geofly_development
pool: 5
username: root
password: ****
host: localhost
socket: /var/run/mysqld/mysqld.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: geofly_test
pool: 5
username: root
password: ***
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: geofly_production
pool: 5
username: root
password: ***
host: localhost
socket: /var/run/mysqld/mysqld.sock
cat schema.rb
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150401095514) do
create_table "delayed_jobs", force: :cascade do |t|
t.integer "priority", limit: 4, default: 0, null: false
t.integer "attempts", limit: 4, default: 0, null: false
t.text "handler", limit: 65535, null: false
t.text "last_error", limit: 65535
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by", limit: 255
t.string "queue", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, null: false
t.string "crypted_password", limit: 255
t.string "salt", limit: 255
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "remember_me_token", limit: 255
t.datetime "remember_me_token_expires_at"
t.integer "failed_logins_count", limit: 4, default: 0
t.datetime "lock_expires_at"
t.string "unlock_token", limit: 255
t.datetime "last_login_at"
t.datetime "last_logout_at"
t.datetime "last_activity_at"
t.string "last_login_from_ip_address", limit: 255
t.string "activation_state", limit: 255
t.string "activation_token", limit: 255
t.datetime "activation_token_expires_at"
t.string "reset_password_token", limit: 255
t.datetime "reset_password_token_expires_at"
t.datetime "reset_password_email_sent_at"
end
add_index "users", ["activation_token"], name: "index_users_on_activation_token", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["last_logout_at", "last_activity_at"], name: "index_users_on_last_logout_at_and_last_activity_at", using: :btree
add_index "users", ["remember_me_token"], name: "index_users_on_remember_me_token", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", using: :btree
add_index "users", ["unlock_token"], name: "index_users_on_unlock_token", using: :btree
end