Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails generate model Investor - getting error "The name 'Investor' is either already used..."

I have an almost new setup of ROR 3.1 here and have already generated 2 models (AdminUser and Advisor), when i try to add another model "Investor" I am getting this error:

"The name 'Investor' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again."

I am using command: rails g model Investor. I have only two models in my project right now and non of them is called Investor...

FIXED: It turned out that my application is called "Investor"; when I created rails app I did: rails new investor. I had to rename all the occurrences of the name of my app to a different name and it works now.

Here is a list of files you have to change:

  • config.ru
  • Rakefile
  • config/application.rb
  • config/environment.rb
  • config/environments/development.rb
  • config/environments/test.rb
  • config/routes.rb
  • config/initializers/secret_token.rb
  • config/initializers/session_store.rb
like image 978
Tamik Soziev Avatar asked Nov 09 '11 04:11

Tamik Soziev


1 Answers

It happened because my application was called "Investor" (same as the model I wanted to add), once I've changed my application name it started to work...

like image 82
Tamik Soziev Avatar answered Oct 07 '22 22:10

Tamik Soziev