今天我打开了旧的 Ruby 项目 将文件复制到我的站点文件夹后,然后运行此命令
bundle
rake db:create
rake db:migrate
rails s
当我在浏览器上打开我的项目时,我发现该项目给了我错误,因为 MySQL 不适用于我,我在控制台上也收到此错误
ActiveRecord::SchemaMigation Load (68.0ms) select 'schema_migrations'.* from 'schema_migrations'
processing by HomeController#index as HTML
Completed 500 Internal Server Error in 92ms
log writing faild. invalid byte sequence in US-ASCII
那么为什么我会收到此错误以及如何解决该问题??
最佳答案
我现在解决了
只是为了解决US-ASCII问题 我将此行添加到模型页面的第一行
#encoding: utf-8
我还添加了这些行
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
在我的 Gemfile 中
然后我收到另一个错误告诉我使用protected_attributes
所以我添加了这一行
gem 'protected_attributes'
在我的 Gemfile 中然后执行:
$ bundle
关于mysql - Ruby on Rails 4 选择 schema_migrations 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22620468/