Updating the Mobility gem - mobility

I would like to update the mobility gem.
Are there any known issues/needed steps when updating from v0.1.10 to v0.3.6 or can it be updated without any further steps needed?

There are no major breaking changes between v0.1 and v0.3. You should be able to update right up to v0.4 (recently released), but of course it's always best to have a set of specs testing your application when upgrading any gem.

Related

Should I pin gem "rails" to a version?

Most rails projects have a very specific version included in their gemfile, right after a rails new foo.
For example gem 'rails', '3.1.3'
Would it not be better to change this to allow dot-version and e.g. define rails as gem 'rails', '~>3.2'?
How is rails version-numbering done? I see major changes between dot-releases, e.g. upgrading from 3.0 to 3.1 requires quite severe changes (mostly to the asset pipeline). How is that for subreleases? Is 3.2.1 a bugfixonly release of 3.2.0?
There's not really any reason not to use the ~> constraint, but you should put:
gem 'rails', '~>3.1.3'
since that will mean any 3.1.x that is at least 3.1.3. Putting ~>3.1 implies compatibility with any Rails version 3.x.
Rails versioning follows semantic versioning, as far as I know.
However, I think the idea of specifying the exact version is that you read the release notes with every release and make a specific effort to validate that it's okay. Ultimately it's all up to you, though. You should be sure you're somehow following a feed for Rails versions so you always know about security releases either way.

Issues with Rails3.0 vs Rails 3.1

So I finally upgraded (and then downgraded because of Unity) Ubuntu and reinstalled RVM but I'b stuck with rails 3.1 now, which is fine but all my old projects are in rails 3.0 and 3.1 has some incompatibilities. Off the top of my head RAILS_ROOT is now Rails.root (which all my projects use in someway), and I was having some issues with heroku when trying to upload a small rails 3.1 app I made to play around (since the PG gem wasnt in my gemlist I couldnt run migrations, and then installing the pg gem caused more issues).
So how do I install rails 3.0 again? I cant seem to find it in the repositories
And I know with gem sets I can install both right? Well if I do that, how do I create a new rails project? Which version of rails would use rails new new_app?
Ok, I understand what you need to do. I would highly recommend making a new Gemset using RVM, that way you can start from scratch and not worry about those things.
To do that, run this in your command line with RVM installed:
// EDIT THIS LINE TO MATCH WHAT YOU WANT
rvm use 1.9.2-or-which-ever-version-you-are-using#temporary_gemset --create
Once this gemset is created, it will be empty, so you can then proceed to install a younger version of rails, like so:
gem install rails -v 3.0.11 // (MAY NEED TO USE SUDO, DEPENDING ON YOUR SET UP)
This should install the older version of rails and its dependencies so that you can still edit and work with your older rails project. Check more of RVM's site for more help on switching between gemsets and creating them.
https://rvm.io//gemsets/
I would still recommend to figure out the differences eventually and move to the newer version for Rails, currently 3.2.5 because they are awesome. Here is some material to show you the differences and new features for when you do that later:
http://railscasts.com/episodes/265-rails-3-1-overview
http://railscasts.com/episodes/282-upgrading-to-rails-3-1
http://railscasts.com/episodes/318-upgrading-to-rails-3-2

Which version of rails to use

what is the best when it come to choosing what version of rails to use in your development?
I wanted to upgrade to the newest version for the new features, but in many cases chances were high that my existing code would be broken, and a lot of extra time definitely needed to spend fixing it. Should I stick with the current version of rails I'm using? or heading for upgrade?
Any advice or guideline would be really appreciated.
It is useful to always upgrade, because new gems might not support older versions of Rails and you wil get new features from Rails which could reduce code. You can do it step by step, fixing time to time code that will break in newer version of Rails. It more like continuous refactoring.
I think you have to check carefully when and how to upgrade. Here are some hints that may help in the upgrade process:
Patch versions (like upgrade from Rails 3.1.0 to Rails 3.1.1) were normally no problem at all. Upgrade whenever possible, normally you don't have to change anything. Sometimes you have to check if other Gems as well should be upgraded, read the release notes, they give (sometimes) hints about that.
Minor versions (like upgrade from Rails 3.0.9 to Rails 3.1.0) come with new features and non-compatible changes. In the release notes, you will find information what has changed and has to be proven before hand. As an example, look at Ryan Bates railscast "Upgrading to Rails 3.1.0". You normally have to do the following steps:
Upgrade to the last patch version before.
Look at the deprecated log messages. These are the ones that may break after the upgrade.
Tag your current application, or branch to be sure to not destroy anything by the upgrade.
Do the upgrade up to the point you are sure most needed features work again.
Merge back your changes, and continue with the upgrade
(Have done that the last few days for an application I have upgrade from Rails 1.2 to 2.0 up to 2.3.8 to 3.0.0 up to 3.0.9, and now 3.1.1.)
Major version upgrades are even more difficult. You have to ensure that you have enough time and resources to check all the minor glitches you may have. Most of the time, there were resources available by the Rails team that help do the upgrade, like the Rails upgrade helper or the 3 railscast "Upgrading to Rails 3".
In any case, you should at least check if the main Gems you are using (additional to the normal Rails gems) are compatible with the version you want to migrate to. This may be tricky, but sometimes, the information is available.
My experience is, that Major upgrades take time, and if you don't have it, don't do the upgrade. Minor upgrades take some time, and depending on the change (assets in Rails 3.1) come with a price tag, which is sometimes, not all of the times, worth it. Patch upgrades are painless and should be done at will.

Upgrade Rails 2.3.14 to Rails 3.1.0, or re-write app fresh in Rails 3.1.0

I have upgraded my app to Rails 3.1.0, and while I have solved many compatibility issues, but I have also noticed that there are many redundant files, junk codes, and some features I have to recode again.
I am just wondering if I should just rewrite my app from fresh in Rails 3.1.0, or continue modifying and fixing after the upgrade? The former one will produce a cleaner app, but more work, and the latter one will be faster, but will also take some time to clean up the mess. What is my best approach?
Thanks.
what I do is create a fresh empty rails 3.1 app. Install my gems with bundler. Then I copy over my migrations, my models and my spec tests. Run my tests. Get tests passing, resolve any incompatibility issues. Repeat with config/routes, controllers, views, etc.

How to downgrade Rails version?

I create my rails application in version 3.0.7.
now i want to deploy my application, but the server is only support 3.0.3
how can i downloadgrade my application?
thanks
replace
gem 'rails','3.0.7'
with
gem 'rails', '3.0.3'
in your gemfile
Then run bundle
On a second note why not upgrade the server to rails 3.0.7?
Unless I'm mistaken... you can't. Well, you can, by:
Creating a new app
Bundle-installing all the necessary plugins, gems, etc
Copying over app files, configs, helpers, tests, everything
Running tests and seeing what doesn't now work
Making changes where required
Unfortunately, I don't believe there exists an easier way.