简体   繁体   English

Ruby 1.8.7-Ruby 1.9.2和Rails 3.0.0“编码”模型名称冲突

[英]Ruby 1.8.7 - Ruby 1.9.2 and Rails 3.0.0 'Encoding' Model Name Conflict

I have a Rails 3.0.0 application that has a model named 'Encoding' and is currently running on 1.8.7 fine. 我有一个Rails 3.0.0应用程序,该应用程序具有名为“ Encoding”的模型,当前运行在1.8.7上。 I'm trying to upgrade to 1.9.2, but the name 'Encoding' is conflicting with that version of Ruby. 我正在尝试升级到1.9.2,但名称“ Encoding”与该版本的Ruby冲突。

I tried creating a new project, and when running rails g model encoding with 1.9.2 it complains giving: 我尝试创建一个新项目,当使用1.9.2运行rails g model encoding ,它抱怨给出:

The name 'Encoding' is either already used in your application or reserved by Ruby on Rails. 名称“编码”已在您的应用程序中使用,或由Ruby on Rails保留。 Please choose an alternative and run this generator again. 请选择一个替代方法,然后再次运行此生成器。

When I originally created the project under 1.8.7, the generator didn't complain. 当我最初在1.8.7下创建项目时,生成器没有抱怨。 Do I have any options to upgrade to Ruby 1.9.2 without having to rename my models and tables? 我是否有任何选择可以升级到Ruby 1.9.2,而不必重命名模型和表? Perhaps some sort of name spacing? 也许某种名称间距? Thanks. 谢谢。

Encoding is a class that was introduced in ruby 1.9. 编码是在ruby 1.9中引入的类。 Change your model name. 更改您的型号名称。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM