

Updating Rails - DanielKehoe
http://railsapps.github.com/updating-rails.html

======
bryanlarsen
Better advice:

make sure you have Gemfile and Gemfile.lock checked into git so you can
rollback if necessary. Then type "bundle update rails".

rvm gemsets are not necessary for bundler controlled apps.

~~~
bradleyland
They're not necessary, but it sure is nice to simply archive your current
gemset and have at it. If the update doesn't work out, you don't have to
download and recompile your old gems again. It's a convenience, nothing more,
nothing less.

~~~
jayferd
Not sure why you'd have to download and recompile your old gems again using
plain old Bundler.

The strategy I've been using (and I think is becoming more popular) is just to
install all of your gems in one big pile, and use `bundle exec` to run your
app in the limited environment provided by the Gemfile.lock. So if the update
doesn't work out, you just twiddle a line in your Gemfile and `bundle exec`
will magically load the older version (after `bundle install`, of course,
which in this case will do zero network I/O).

------
DanielKehoe
I wrote the article because a Google search for "updating rails" doesn't show
any helpful results. With the urgent need to update to Rails 3.2.11 because of
the recently announced security vulnerability, developers need to know what to
do (especially part-time and hobby developers).

~~~
lengarvey
I wrote a slightly different article:
<http://bottledup.net/2013/01/10/bundler-and-gemfile/>

It focuses on Bundler and your Gemfiles so that people understand not only how
to update rails, but their other gems too. Personally I don't like rvm gemsets
for bundler controlled apps (like rails) and think that rvm, bundler, rubygems
and so on only serve to confuse the same part-time and hobby developers.

------
chao-
Operations noob here. Honest question: _How do I apply the patch file?_

I've never seen one before, and I've managed to gather, via Google and Stack
Overflow, how to use a git .patch (I think anyway), but I deploy on Heroku and
can't directly access the source of my gems.

I already have the workarounds in place for now, but I'm very bothered that
"use the patch" is a meaningless phrase to me. It seems like a useful thing to
know for future scenarios.

~~~
tomfakes
You do not need a patch file

All you need to do is:

    
    
        update your Gemfile to the correct version of Rails
        run **bundle update rails** in the root of your directory
        then **git commit -am "update rails"** to save the files
        then **git push heroku** to update on Heroic
    

The Heroku email has the information for all the Rails versions - if you are
running 3.1.4, then you need to update to 3.1.10, if 3.2.X then 3.2.11 is your
new version - this should be a safe update. Just pick the latest number for
the X.Y version that you currently have in your Gemfile.

~~~
chao-
Right. I understand that much, but entire swaths of our application become
unusable when I upgrade. Chalk it up to "legacy" code from when I was first
learning Rails.

Since that is fundamentally my own problem, and I have to deal with it over
time and within my team's constraints, I didn't want to bore anyone with the
details of why I don't just update the gem.

Thank you for the reply/help, but my question remains: Is it possible to use
the these kinds of patch files on Heroku, and if so, how?

\--

EDIT: Responding to tomfakes here since HN won't let me:

I am only going from 3.2.2 to 3.2.11. I think the breakage is query-related,
and it's actually quite embarrassing how bad so much of my old code is
(procedural doesn't even begin to describe it). But this is how one learns, I
suppose, and now I'm very incentive to go back and refactor/fix all of it.

I'm just worried about the in-between time, and bothered that this process of
"applying a patch" is a mystery to me.

~~~
tomfakes
It seems strange that your app is so broken with a minor version update. Are
you sure you are changing just the last number in the string, and not trying
to jump a full version of Rails?

~~~
jeltz
Rails 3.2.9 contains at least two API changing merges.

    
    
      https://github.com/rails/rails/pull/7509
      https://github.com/rails/rails/pull/7661

