Search code examples
ruby-on-railsrubyruby-1.9.3bluehostruby-1.8.7

How do I adapt a Ruby 1.9.3 app to work on a Server using Ruby 1.8.7


I have an app written with Ruby 1.9.3 with Rails 3.2.6. After the fact I'm deploying on Bluehost, no choice here, who has Ruby 1.8.7 on the server.

I'm getting the different time format error on my gems. I can edit them on the server but next time I do a cap deploy I'm going to wipe the changes and have to do it again. BH let me upgrade Rails to 3.2.6 from the command line but I can't upgrade to Ruby 1.9.

  1. Can I upgrade the server or am I going to have to rewrite my app with Ruby 1.8?
  2. If I do rewrite will I have to do it again when they upgrade all of their servers to 1.9?

I have called and done live chat with BH and they always send me to the set up page for new apps.


Solution

  • First of all, if the App runs on 1.8.7 it will (most likely) run on 1.9.x aswell.

    The other way around is a bit harder... Rails 3.2.x is the last Version of RoR to support Ruby 1.8.7. But unless you used --old-style-hash when creating, you'll have quite some work to do.

    Depending on how complex your code is, it may be enough to fix all hashes:

    # Ruby 1.9:
    hsh = { foo: "bar" }
    
    # Ruby 1.8 and 1.9:
    hsh = { :foo => "bar" }