updating rails previous project to current version - ruby-on-rails

i have a project of rails with versions ruby 1.8.7, gems 1.3.6, rails 2.3.5
I want to update the project to the current version can you guys please give the picture how to update older rails applications to current version....
thank you..

RVM and Bundler with the use of a gemfile is helpful in the situation you are in.
RUBY Versioning
Install Ruby Version Manager (pay careful instructions to how to install)
Installation documentation for RVM is here https://rvm.io/rvm/install/
once installed download the version of RUBY you want to use
rvm install 1.9.3 or rvm install 1.8.7
afterwards type in RVM use 1.8.7 and it will set your system to use the older version
Gem Versioning
Apparently you can install the gems in rails 2 by using the rake command
enter in rake gems:install
Your code to config gems are located in the config/environment.rb
There is a helpful tool called "Bundler" which is a gem that easily lets you manage your gem version through the use of a file called a "gemfile". I think the link below is a good resource on how to upgrade your Rails 2 project
http://llamarada-cinetica.heroku.com/blog/2011/02/14/using-gemfiles-on-rails
with RVM and gem configuration you can upgrade gems as needed and check if it works with your build.
(others please correct me if i'm wrong I've only been on rails for a short while)

My suggestion is If your client want you to update the project you can update else extend the application features with older version of Rails because lots of features will break if you upgrade to new Rails version.
And your question is not suitable to ask in Stackoverflow.

Related

Do I have to install Ruby from source to get Ruby 2.2.0 and Rails 4.2.0 installed on my windows machine?

I currently have Ruby 2.2.6 and Rails 5.0.1 installed on my Windows 10 machine. I have cloned an existing project that has the following settings included in its Gemfile:
# Lock-in Lang and Framework:
ruby '2.2.0'
gem 'rails', '4.2.0'
I'm having a surprisingly hard time figuring out how to get Ruby 2.2.0 and Rails 4.2.0 installed. Ruby has good documentation of different installation options, but I think I've exhausted the Windows options without any success. Here are a couple I tried:
Installers: I couldn't find an option for downloading either from RailsInstaller, RubyInstaller, and Bitnami.
RVM: I tried (unsuccessfully) following this blog post to install cygwin so that I could use RVM, but then saw in the comments that the author now recommends spinning up a linux VM rather that using this method.
Pik and Uru: It appears Pik is no longer maintained, and I couldn't figure how to download new versions and ruby and rails with Uru as opposed to managing already downloaded versions.
EDIT: I also tried simply changing the version numbers for ruby and rails in the Gemfile to 2.2.6 and 5.0.1. When I do this I (very understandably) get a message when I try to use a rails command saying I need to run bundle update rails. When I run that rails update I get the following error: Bundler could not find compatible versions for gem "rack". I've done some googling on that option, and it looks like resolving that issue might be possible but requires some more involved tinkering with my Gemfile configuration.
I think my next option is to install Ruby from the source, but I wanted to throw a question up here first to make sure I'm not missing an easier method. So my question is - is it really this hard to get an older minor release of ruby and rails installed on Windows? I realize that the majority of users are probably looking for the most recent release, but it doesn't seem to me that my use case is terribly unique.
The oldest available Ruby 2.2.x via RubyInstaller is 2.2.1
So, the answer to your question is, "Yes, you'll have to build from source."
But then again,
v2.x of gem "rack" requires at least Ruby v2.2.2
And depending on what other gems are included in your Gemfile, you'll still have to reconfigure your Gemfile to get this app running.
So the best solution is probably to use the latest patch version of Ruby 2.2.x and lock rails to 4.2.x. (The app may not be compatible with Rails 5.x)
# Lock-in Lang and Framework:
ruby '2.2.6'
gem 'rails', '~> 4.2'
Then run bundle install to install all the gems required by the Gemfile

I am having trouble uninstalling Rails 4.1.5 and installing Rails 4.0.8

I tried uninstalling Rails 4.1.5 by doing "gem uninstall rails" and then installing Rails 4.0.8 by doing "gem install rails --version 4.0.8". However, now when I try to see what version of Rails I am using by doing "rails -v" I still get "Rails 4.1.5". How do I fix this?
I know I'm a bit late however I am answering in case others need an answer of how to manage gem versions. The linked duplicate question offers a perfectly fine answer to the question but does not give guidance to how to easily manage this long term. I do the following before starting every new project.
First you need rvm to manage ruby versions and create gemsets. With gemsets you can create isolated groups of gems that are project or ruby or rails version specific (it's up to you how you organize yourself).
After installing a version of ruby to use you create a gemset and tell your system to use this version of ruby with this gemset.
Then select the gemset and install the version of rails you want to use into the gemset. You will also need to install bundler into the gemset.
Once you have this setup you can insert the following lines into your rails gem file to tell this project which ruby version, rails version and gemset to use (in my example I am using ruby version 2.1.5 with the gemset named scan and the rails version 4.0.8)
ruby '2.1.5'
#ruby-gemset=scan
gem 'rails', '4.0.8'
Then cd into the rails project directory and run bundle install. Bundler will install the gems from your project's gem file into the selected gemset. Now you have an isolated and stable system for the project. If you have another project with different ruby version, rails version and gemset any changes there will not affect anything here.
For more details on how to setup rvm just go to the website and read the documentation. It's really easy to use and will save you many headaches.

Specifically stating the Ruby version in my Rails project (RVM)

I'm a little confused on using Ruby Version Manager. I was just wondering how to handle ruby updates for my web apps.
For example, I start a new Rails project and I tell RVM to use a specific version of Ruby like so:
rvm use ruby-2.0.0#my-project-name --create
Then say months down the road a new version of Ruby is released. What do I do then? Do I go back in and tell RVM to use the newer version? I want to build something that is always using the latest version of Ruby.
I'm assuming people build Rails apps, but don't always update to the newest version of Ruby and Rails?
Thanks, just starting out with all this, and trying to wrap my head around it.
There are three parts in this, Ruby, Gems and Rails Project, RVM can help organize everything in this order Ruby Interpreter/Version -> Gemset -> Rails Project
First Ruby:
You can use rvm list known to list all Ruby versions available in MRI, Rubinius, JRuby and others, after that you can install any version and interpreter like:
If you use MRI then rvm install 2.1 will install the latest in the 2.1 branch (2.1.1 being the latest).
For Rubinius rvm install rbx will install the latest stable Rubinius.
For JRuby rvm install jruby will install the latest stable JRuby.
After installing the version you're going to use, you need to specify that you're going to use it, like this for Rubinius: rvm rbx.
Second Gemset:
RVM gives you the ability to define different gemsets in each installed Ruby version that allows you to install gems for a specific project. For this Rubinius version I can:
Create a gemset like rvm gemset create latestRails.
Use a gemset rvm rbx#latestRails.
Show current Ruby/gemset rvm current.
Install latest Rails version in this gemset gem install rails.
Third Rails:
To keep Rails updated, you can use Bundler with a command like bundle update to keep all the gems updated (this are updated inside the current Ruby/gemset and the Gemfile) or a list/single gem of the project, for more info see "Bundle Update Documentation".
I hope I could help you.

gem uninstall rails and it still exist , didn't installed but it said it did

I git cloned an open source software and is currently planning to contribute to it. Originally I installed ruby 1.9.3 with rvm and installed gem install rails - which fetched version 4.0 (newest version)
I installed ruby 2.0 as well with rvm and did 'gem install rails' which also fetched me version 4.0
I was planning to installed ruby 1.9.3 with rails 3.2.13 - an older version of rails
to work with different software and switch between them using rvm
So since my open source software is written in 1.9.3 and rails 3.2.13, I tried
gem uninstall rails
and removed all the rails version
but when I do
rails-v ,
it is still 4.0
I figured out from another question that there are folders associated with 4.0 that I need to remove to remove 4.0, another question suggest that I install rails 3.2.13 but when I make a new app I can just do rails 3.2.13 new app etc. I installed that under 1.9.3 when I switch to 2.00 which still has 4.0, I tried rails 3.2.13 new app and it ran which I don't think it should.
I am growing semi-frustrated with this, and I wish someone can help me while I browse even more questions.
You should create a new gemset within rvm for this. That way you can use a different version of ruby and rails than your system default. Switch to ruby version 1.9.3 in RVM and then use rvm gemset create <name-here> and then rvm gemset use <name-here> to create and use the new gemset. Switch to the directory of the project you cloned and run bundle install to install all of the necessary gems, including rails (assuming the rails version is specified in the Gemfile.)

How can I uninstall Ruby on Rails on Mac OS X?

I am following a tutorial about Ruby on Rails, and the tutorial got updated to a new version of Rails, so I can't follow it anymore because I have an older version.
I would like to start new and uninstall Ruby on Rails and any related software on my Mac OS X 10.5.8, and follow it from ground up. If anyone would be willing to help me uninstall Ruby and Ruby on Rails, it would be much appreciated.
Download RVM or RBENV and upgrade to the latest Ruby (2.3.0 at this point). Don't touch your system Ruby.
Are you uninstalling Ruby on Rails, or Ruby AND Ruby on Rails?
If you want to uninstall Ruby on Rails it should be a simple matter of using gem uninstall rails or doing gem dependency rails and then gem uninstall for each of the listed gems that Rails depends on. If you installed them system-wide, using sudo originally, you'll have to use sudo again to uninstall them.
If you want to uninstall a system-wide Ruby you installed from source, well, I'd probably leave it alone and install any new versions of Ruby using RVM. The older version won't be visible to apps unless you want them to see it or set your path to include it. RVM's version will be found first unless you do rvm system.
Actually you could simply install RVM and have it install your new versions of Ruby, then from there install new versions of Rails, without even bothering to uninstall the old stuff. RVM really is that cool.

Resources