新手问题 请问下关于把数据库换成 mysql 的问题

Unknow user · October 29, 2012 · Last by mengjiawa_bill replied at October 31, 2017 · 2047 hits

请问一下,我在学习的过程中一直使用的是 rails 的默认的数据库 sqlite3,一直都很正常的,但是当我切换到 mysql 时,其它的部份都还是好的,但是当访问有关于 edit 和 show 动作的时候,则会出现这个错误 undefined method `reverse' for nil:NilClass

我的 rails 版本是 Rails 3.2.5 系统是 debian 6.06 amd64

database.yml 中的配置是这样的 development: adapter: mysql2 database: rails_develop encoding: utf8 reconnect: false username: root password: "9006123" pool: 5 socket: /var/run/mysqld/mysqld.sock

请问一下这是哪里有问题?谢谢

仔细观察你的错误信息,这个错误可能跟数据库无关。

Unknow user #2 October 29, 2012

嗯,谢谢,我在看一下

我也遇到了这个问题

4 Floor has deleted
# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# 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.
test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3

如何把数据库换成 mysql2

You need to Sign in before reply, if you don't have an account, please Sign up first.