I am creating Car model in Rails 3 by using command:
rails generate model Car name:string id_str:string
but I got the error:
Well through a bit of debugging and playing around, this is what I ended up doing:
for x in `gem list --no-versions`; do sudo gem uninstall $x; done
This forces all 'old' gems to be removed. I then proceeded to verify the gem environment to confirm that gem was using the correct ruby version:
sudo gem env
The error experienced is due to the fact that rails is still trying to use ruby 1.8, which causes all sorts of issues.
Once all of the above checks out properly do:
sudo gem update --system
sudo gem install rubygems-update
sudo update_rubygems
Which will make sure that you are at the latest gem version. Then:
sudo gem install rails
This will install everything you need. I ran all of the gem commands as sudo, to make sure that my root install was properly configured/setup.
Your final gem env should look something like:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.13
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-darwin10.8.0]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/1.9.3-p0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/1.9.3-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1