I have been able to successfully upgraded from 3.0.1 to 3.0.6 by editing the Gemfile and bundle update...
I like the fact that if something goes wrong I can revert back to the version 3.0.1
Is is also possible to upgrade to rails 3.1.1 just using bundle and go back to 3.0.6 if something does not work in the rails version?
Bundler just point your app to the right libraries (and, of course download all dependencies!).
Your app needs to fit the proper version of the libraries. So is it for Rails.
To conclude, you can't upgrade from rails 3.0.x to 3.1.x via bundler but there is a Railscast for this :)
Related
I have a huge rails web application with wide user base which runs on Rails 4.2.2 and Ruby 2.2.2 as of now. I simply want to upgrade the whole application to the latest version of Ruby i.e. 2.5.0 and Rails 6.0.2.2.
The reason for upgrade being I want to integrate a completely separate React.js frontend and a separate Rails backend. Other reasons for upgradation being deprecating older version of gems and rails.
I have tried researching a lot for this. I have also tried the : https://guides.rubyonrails.org/upgrading_ruby_on_rails.html guides. But everything out there is so vague and haphazard. I havent found any clear cut method until now following which I can upgrade my rails application smoothly.
Please help.
What i would recommend you to do is to upgrade to Rails 5.x.x first and than to 6.x.x you can use those guides and follow step by step:
https://www.ombulabs.com/blog/rails/upgrades/upgrade-rails-from-4-2-to-5-0.html
https://selleo.com/blog/how-to-upgrade-to-rails-6
I would recommend a progressive update for both Ruby and Rails. I would for example start by updating Ruby from 2.2.2 to 2.3, using the Release notes as guide of what things have changed:
https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released
Once that work (which would be easy to check if you have high test coverage), I would continue with Ruby 2.4 and so on.
Ruby minor releases (for example 2.2.2 to 2.2.3) shouldn't include breakable changes, so you can just go from 2.2.2 to 2.3, 2.4, 2.5 ...
Also, note that the last version Ruby is 2.7.1 and not 2.5.0. Another good reason to update your Ruby version is that it is not maintained any more and it does not receives security fixes. 2.5.8 is in security maintenance phase, which means that it won't be maintained anymore soon. You may want to update to at least Ruby 2.6.
Regarding Rails, you can find the release notes here: https://guides.rubyonrails.org/5_0_release_notes.html (just change the number in url to get the information of a different release).
Trying to migrate application from Rails-1.1.2 to 2.0.0 to current version.
Basic problem is can't find documentation for it.
I think in Rails 1.1.2 they don't have command to update the application like bundle update rails or rails app:update.
Directly changing ruby version gives boot error.
The first thing you need to do is to upgrade your Rails app to version 1.2.6, which is documented here.
After that you can upgrade to Rails 2.0, which is documented here.
The Rails releases page might be a useful page for you to check out, since they hold the info on how to upgrade. Like you said, there's hardly any information on how to upgrade the older Rails versions, so the official releases page is your best bet.
I'd upgrade to each release individually, so from 1.1.2 to 1.2.0, then to 1.2.6. Then go to 2.0, 2.1, etc. Update your Ruby seperate from it.
You can't directly migrate rails-1.1.x to rails-2.0 due to till Rails 2.3 doesn't have built-in bundler support because it came out before Bundler and no Gemfile in rails also that not a good way to directly update the ruby.
Note: before migrate to any version make sure you have more than 70% test coverage.
Steps help to migrate
Change the rails version (rails 1.1.x to rails 2.0) manually (means in vendor folder).
Run the test case and fix the failing syntax in your code (If any)
Then migrate rails 2.0 to rails 2.higher version (make sure higher than rails 2.3)
Again Run the test case and fix the failing syntax in your code (If any)
Then migrate rails 2.x to rails 3 pre version
Now you can add Gemfile put all gems into that upgrade your bundler gem.
Now you can migrate the ruby version as well.
Again Run the test case and fix the failing syntax in your code (If any)
Then migrate rails 3.0-pre to rails 3.higher version
Again Run the test case and fix the failing syntax in your code (If any)
Then migrate rails 3.x to rails 4 pre version
Now you can migrate the ruby version as well.
This is very long successful process for rails migration if your rails version older that 3.0.
There is one more way to achieve that. If you just want a Gemfile, rather than Bundler integration with Rails, you can create one easily enough.
gem install bundler
bundle init
Then follow below Guide to The Rails Command Line may help you, especially the section that covers rake gems:install.
https://guides.rubyonrails.org/v2.3.11/command_line.html#rake-is-ruby-make
I hope that help you.
Before looking at starting to upgrade an app from such an old version of Rails, I'd suggest reviewing how complicated it is and questioning if it would actually be quicker to build from scratch in the most recent version rather than go through so many upgrades.
I can't seem to find this simple yes no question online so sorry for the super noob question!
I'm using an EC2 instance for my development and I set it up to have ruby 2.1.1 and rails 4.1. I have RVM, but don't actually have any other ruby versions.
I cloned my friends project and told him I would start helping him. His project is a ruby 2.0 and rails 4.0.4.
He's concerned that when I merge changes it will update the project to 2.1.1 and rails 4.1 and then it will crash on his computer (since he doesn't have 2.1.1 or rails 4.1)
I don't think this is the case, but I'm not 100% sure, so how valid are his concerns? I was under the assumption that as long as I don't use any functionality from rails 4.1 and 2.1.1 that isn't in 4.0.4 or 2.0.0 then there is no need to be concerned. Also, I assume when I cloned the project and make changes to it, it should stay in 4.0.4 and 2.0.0 versions. Is that true?
Thanks for any clarification!
The Rails version should be defined in Gemfile, so unless you change it, it will stay the same (and when you run bundle install the proper version will be installed if it's missing, so even on your computer you will not work on Rails 4.1, but on Rails 4.0.4).
With Ruby version it's a bit more complicated, because it can be defined in some file (like .rvmrc or .ruby-version), but does not have to. Still, if you don't change anything in project's configuration, neither Ruby nor Rails version will be changed.
If you are physically merging a 4.1 into the 4.0.4, then you will most likely encounter some issues. (I don't know the exact differences between those versions, but a full minor version up usually comes with new/changed goodies)
If you are just working on each app separately, then they would be isolated by their Gemfile. This is assuming the Gemfile.lock has been saved into the repo. Or the versions have been locked in the Gemfile itself.
Your Ruby version probably won't matter if you are running the bundle install fresh on your current version. Unless there are specific needs for a specific version.
I recently upgraded to ruby 1.8.7. i'm running Rails 2.3.5 and rubyGems 1.5.2.
ever since I upgraded, every time I want to start the server, i get:
undefined local variable or method `version_requirements' for #<Rails::GemDependency:0x1022cc1c8> (NameError)
this post here advises to downgrade rugyGems to a version below 1.5.0.
downgrading doesn't seem to be the right solution..should I maybe be upgrading Ruby or Rails instead?
Also, if I upgrade to the latest ruby (1.9.2) and rails (3.0)..will my application break?
I have a very large application and can't figure out how to upgrade it without breaking the application..
That thing about version_requirements is a bug in rubygems - confirmed by their creators.
I've also participated in the bug report on the rubygems :)
gem update --system 1.5.0
performs a graceful downgrade until this is fixed.
I ran into this issue with some Rails 2.x applications and once also with 3.0.4 application, but with different error message, again, downgrading rubygems solved it.
You should use RVM so you can have both, 1.8 and 1.9.2 Ruby versions, running and you can be working with rails 2.3.x and rails 3.x the way that you want
I have updated rails and have rails -v and it says 3.0.5. (which is good) when i open my old programs, will it still always use 3.0.4 as that is what was used?
And ..
when i create new one will it use 3.0.5
I have done this as i'm a newbie and having problems with tutorials from the rails by example book michael hartl and wondering if it is the version that is giving the problems.
Thanks for any help..
In Rails 3 Bundler was added to handle gem dependencies. Within each application a Gemfile exists that specifies the version of Rails to use. If you want to update an application change the version in your Gemfile and run bundle install.