So you have just installed ruby 1.9 on your hosting account and now you are wondering what you can do with it, perhaps you'd like to deploy the last incarnation of your new rails app on ruby 1.9 and in this post I'll describe how to easily do that.
I assume you have already installed ruby 1.9 on your server, otherwise, follow
this tutorial.
First, you have to install a few gems on your server. Assuming you don't have any dependency for your app, you'll just need rails, rack and sqlite3, otherwise, check your gem compatibility
here and repeat the following step for each of those gem:
gem19 install rack rails sqlite3-ruby
You can see that I added the 19 suffix to the gem command, because I've previously installed ruby 1.9 with the same suffix.
Now you simply have to tell rails to use ruby 1.9 to start itself. If you look to the files inside the script/ directory, you'll see that each one begins with the following line:
#!/usr/bin/env ruby
You have to replace each of them with:
#!/usr/bin/env ruby19
And now you can start your server as usual with script/server. If you see any error, check the backtrace to see which plugin/gem is causing it and try to google about it, but hopefully your application will run smoothly from the first time.
If you want to see a real world example, check out
rubyxp.com which is running with ruby 1.9 on a shared
Dreamhost account.
Comments