views:

27

answers:

1

I have a Rails 3.0.0 application that has a model named 'Encoding' and is currently running on 1.8.7 fine. I'm trying to upgrade to 1.9.2, but the name 'Encoding' is conflicting with that version of Ruby.

I tried creating a new project, and when running rails g model encoding with 1.9.2 it complains giving:

The name 'Encoding' is either already used in your application or reserved by 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. Do I have any options to upgrade to Ruby 1.9.2 without having to rename my models and tables? Perhaps some sort of name spacing? Thanks.

+2  A: 

Encoding is a class that was introduced in ruby 1.9. Change your model name.

jpartogi
The application is deployed, and changing the names and table names will require a huge amount of work. Any chance of doing something else?
Kevin Sylvestre
Nope. Actually: huge amount? Renaming the table-name is easy using migrations. Renaming inside your project is dead-easy if you use Rubymine. If renaming the table is too much hassle, you can write inside your renamed model: `set_table_name "encodings"`
nathanvda
I'll check out Rubymine (using TextMate it appeared more difficult). Also, we have a few other queries that run on the database I was concerned about, but the set_table_name should do the trick!
Kevin Sylvestre