I've got Snow Leopard with Rails 2.3.5 installed along with other versions (2.2.2 and 1.2.6). I'd like to use 2.2.2 as the webserver I want to deploy to uses a 2.2.x version of Rails. I've tried to uninstall Rails 2.3.5 but get this error:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rails`
Is there any other way of setting the Rails version to one of the other installed Rails versions?
You should really take look to RVM(Ruby Version Manager) it's awesome!
https://rvm.io
http://teachmetocode.com/screencasts/rvm-ruby-version-manager/
Cheers
Denis
You should be able to do this without needing to uninstall anything. You can specify the version of rails you want to create an application for by typing the following when creating a new app.
rails _2.2.2_ app_name
Related
I am trying to run an old rails app, but I am receiving this error after calling $ rails server:
uninitialized constant AppGenerator::Config
Did you mean? RbConfig
I am brand new to Rails, and I really don't know what this means/where to start. The app is supposedly built on 2.3.8. My computer says I have 2.4.1 and 2.3.18 installed.
I would like to know if I should install 2.3.8, or if I should upgrade to the latest version? Also I don't understand the error that is coming up, where should I look in the app to fix this - or is this a Rails problem?
Verify the version your project is built type bundle show inside it. It's gonna show all the gems and your respective versions.
And to check the rails version just type rails -v in your terminal.
The gemfile in the app folder should tell you what version of rails it is.
You can use bundle update to update the version or if you have a newer version and want an older version, do gem uninstall rails and then gem install rails -v "version number" for example, gem install rails -v 2.3.8.
You can check the rails version on Gemfile.
Try the command rake about to see the application environment.
I would suggest to have your environment setup same on the Gemfile, your application might have compatibility issues if you use a lower version.
I'm new to rails. After finally getting my environment to work properly with RVM 2.0.0 rails 4.0.5, all of a sudden rails disappeared and I keep getting the message: Rails is not currently installed on this system...
When I quit terminal, reopen it, and type:
$ rails v
It shows 4.0.5
However, as soon as I change directory into my rails app and check the rails version I get the message that rails is not installed.
Any idea what's going here?
When you use rvm you have multiple versions of ruby installed. You select which one you want like this:
rvm use 2.0
or
rvm use 2.1
You can also specify a ruby version in a .ruby-version file in a directory. Then when you change to that directory in the terminal, RVM will switch versions for you.
Each version of ruby has its own set of installed gems. Rails is a gem.
Ergo, when you installed rails, you were in your default ruby version (probably the one build-in on your system). When you change directory to your rails application, RVM is kicking in to switch to the correct ruby version for you. But you don't have rails installed in that version.
So the solution is to switch to the directory for your rails app and run:
bundle install
This will install your gem bundle for your application, including the rails gems, and it will do it into the correct ruby version.
Currently Rails 4.0.2 is installed in my Windows machine and I'm using it for several rails projects. But, I do want to use Rails 3.2.8 version for another project.
So, my question: Can I specify the version 3.2.8 on a single project and retain 4.0.2 in all the rest by ensuring all dependencies for 3.2.8 are installed?
Yes !
Install the rails 3.2.8 gem.
Then, you can specify which version of rails you want to use :
rails _3.2.18_ new mySuperSecretProject
In each project, you can use rails _xxx_ console, but it is easier do directly use the binstubs : bin/rails console
Yes you could do it as Intrepidd stated.
Another way to do this is by including a specific gem version in your application Gemfile and then do a bundle install. This will tell the application to use that particular version of rails over your system version
Rails can be installed as follows:
1) Specify the rails gem version in your project Gemfile
gem 'rails','3.2.8' OR gem 'rails', '4.0.2'
2) Try running bundle install. it will automatically install required rails version for you and will create a bundle unique for the project you are in.
3) For rails 4.0.2 project: if rails 3.2.8 is already installed, try running 'bundle update rails' to upgrade the current rails version and it will install all of its dependencies in the corresponding bundle.
If you want to run these projects in different ruby versions, then in Linux platforms RVM is the best option. But, in windows RVM will not work. A good option will be the Pik tool. Pik is a tool to manage multiple versions of ruby on Windows.
Please refer here for the same. Hope it helps :)
I started a Heroku Rails app using Ruby 1.9.3 and Rails 4.0.1.
I decided soon after to update my ruby version to 2.0.0 as this apparently works better with Rails 4.0.1. So, I installed the ruby2.0 package using apt-get and other associated packages, then I set ruby 2.0.0 as the default using sudo ruby-switch --set ruby2.0, finally I updated the Gemfile in my app, changing the line ruby '1.9.3' to ruby '2.0.0' Now, when I run bundle install I am presented with this error, and I don't know why...
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
Following this heroku guide didn't seem to help... I set the path to what is shown there and it didn't seem change anything. Maybe I am being stupid and there is something in that path that I need to replace something with information specific to my machine? I feel like the part where I set vendor/bundle/ruby/2.0.0/bin should have some specific info, like changing "vendor" to something but I don't know what... I'm not totally familiar with this stuff yet, this is my first time using heroku and ruby.
EDIT: I forgot to mention (in case it is important) I am running Xubuntu 13.10.
I believe I have fixed the issue. I was somehow running the bundle command which was installed for ruby 1.9.3... so when it compared the gemfile definition with the version it was running on they mismatched. Re-rerunning sudo gem install bundler has sorted it out.
Hi there thanks for looking into this.
after a clean install of Linux ubuntu 10.10 i tried to re-install rails.
after doing sudo gem install rails, I can see I am returned version 3.2.3 of rails
But after generating a new project i couldn't find my gemfile so i tried ruby -v which returns 2.3.4 wich is odd since I know I got the latest.
Also when trying sudo gem update --system I get an error because I might override system files. any solution here?
I'd recommend using rvm to manage your ruby sets -- as well as defining gemsets for each project that will allow you to make sure each project has just the gems it needs.
Here's a link to the rvm installation instructions (they should work with ubuntu):
https://rvm.io/rvm/install/
Here's some info on basic use of gemsets with rvm:
https://rvm.io/gemsets/basics/
Also, when using rails 3+, you should make a practice of typing bundle exec rails -v -- that way you'll use the gems defined for the project you're in.
Can you try typing bundle exec rails -v and letting us know what you see?