简体   繁体   English

Ruby on Rails 4选择schema_migrations错误

[英]Ruby on Rails 4 select schema_migrations Error

Guy today i was open old Ruby project after copy the files to my Sites folder then run this commands 伙计,今天,我将文件复制到我的Sites文件夹中后,打开旧的Ruby项目,然后运行此命令

bundle
rake db:create
rake db:migrate
rails s

when i was open my project on the browser i found the project gives me errors because MySQL not work with me also i got this error on the console 当我在浏览器上打开项目时,我发现该项目给了我错误,因为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 

so why i got this error and how i can solve that ?? 那么,为什么我会收到此错误以及如何解决呢?

I solved it now 我现在解决了

just to solve the US-ASCII issue i added this line to the first line in my model page 只是为了解决US-ASCII问题,我将此行添加到了模型页面的第一行

#encoding: utf-8

also i added the lines 我也加了线

if RUBY_VERSION =~ /1.9/
    Encoding.default_external = Encoding::UTF_8
    Encoding.default_internal = Encoding::UTF_8
end

in my Gemfile 在我的Gemfile中

then i got another error told me use protected_attributes 然后我又遇到一个错误,告诉我使用protected_attributes

so i added the line 所以我加了线

gem 'protected_attributes'

in my Gemfile and then execute: 在我的Gemfile中,然后执行:

$ bundle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails 创建 schema_migrations - Mysql2::Error: Specified key was too long - Rails creating schema_migrations - Mysql2::Error: Specified key was too long Rails单元测试由于对schema_migrations的唯一约束而失败 - Rails unit tests fail because of unique constraint on schema_migrations MySQL 上的 Rails `schema_migrations` 的结构是什么? - What's the structure of Rails' `schema_migrations` on MySQL? Mysql2 ::错误:表.schema_migrations'不存在 - Mysql2::Error: Table .schema_migrations' doesn't exist Mysql2 :: Error:对表'schema_migrations'的用户'username'@'host'的INSERT命令被拒绝:INSERT INTO`schema_migrations`(`version`)VALUES('') - Mysql2::Error: INSERT command denied to user 'username'@'host' for table 'schema_migrations': INSERT INTO `schema_migrations` (`version`) VALUES ('') MySQL Schema_Migrations-活动记录-更新值 - MySQL Schema_Migrations - Active Record - Update Values 是否有必要在rails中的ruby中的MySqlWorkBench中完成模式更改的迁移? - Is it necessary to run migrations for schema change done in MySqlWorkBench in ruby on rails? Rails 3-如何通过数据库模式更新我的迁移 - Rails 3 - how to update my migrations by DB schema Rails 3:“架构迁移表尚不存在” - Rails 3: “Schema migrations table does not exists yet” Rails 3 - 突然发生的迁移错误 - Rails 3 - suddenly pending migrations error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM