Minh Triet
Minh Triet

Reputation: 1250

Calling 'rails new demo' created a folder named "new"?

I installed Ruby and Rails using apt-get in Ubuntu. Then when I test my installation, this thing happen.

When I call rails server inside a rails-created-folder, rails created a new folder called "server" for me, with a correct folders structure, including controller folder, app folder, gemlock file, etc.

How could it possibly happen? I will try reinstalling RoR, but has anyone encountered this?

Last time, I used RVM, but whenever I create a new app, I will have to waith for rails to redownload all the bundle file, but in this installation, I don't have to. Can you help me explaining it?

Thank you and best regards

Upvotes: 3

Views: 780

Answers (1)

Andrew
Andrew

Reputation: 43113

As pointed out in the comments, it sounds like your rails executable is rails 2.

  1. Try gem uninstall rails, select all versions.

  2. Run rails -v. If this command works you've got a system version of rails that isn't being handled by RVM. BTW, this is why many rails devs are shifting from RVM toward rbenv + bundler.

  3. If you still have rails after gem uninstall, run sudo gem uninstall rails. On RVM, sudo gets to your system gems. You might want to sudo gem uninstall everything, so you don't have this conflict in the future.

  4. gem install rails, you should get version 3.2.8.

  5. Try rails new my_app again. It should work. If this doesn't work, try the following:

Create a parent directory for your rails projects, like ~/rails. Then create a GEMFILE that looks like this:

source :rubygems
gem 'rails', '~>3.2.8'

Then inside ~/rails run bundle exec rails new app_name.

If that doesn't work... you've got a bigger system config problem of some kind I guess.

Upvotes: 3

Related Questions