Which version of Ruby?
I'm just starting out in Ruby (Rails actually) and the book I'm reading covers Ruby 1.8.6, RubyGems 1.0.1, Rails 2.0.2 and SQLite 3.5.4, but the current stable releases of these are 1.9.1, 2.3.8, 1.3.7 and 3开发者_运维问答.7.0 respectively, should I still proceed with the book or find another?
Also, I couldn't find a recent guide/tutorial to walk me through the installation of these latest versions, would be great if you could help with that too. I'm on Mac OSX Snow Leopard (10.6.4).
Many thanks!
There are a large number of projects with major release milestones just around the corner. These include Ruby 1.9.2 (the 2nd RC is already out), Rails 3.0 (the RC is already out), and a number of other libraries and plugins. Please note that Rails 3 does not support Ruby 1.9.1, although it does support 1.8.7 and 1.9.2.
I would start out with Ruby 1.9.2-rc2 and Rails 3.0.0.rc. These are what will be the current version over the next few years, starting within the next few weeks. Previous versions of Ruby and Rails will be legacy.
Look for new editions of books coming out, having been updated for Ruby 1.9.2 and Rails 3.0.
I were like you. Although Ruby is popular, they are very bad and inconsistent in such kinds of various versions. Firstly, I thought that the latest version is always the best, which holds the true for most languages. Later, in these days, due to the removal, re-structure and redesign of logic and underlying codes, the latest version is not always good for programmers who are used to writing codes in older version. See python case (2.x vs 3.x). So, for ruby, if you're holding a book that teaches you in ruby 1.8.x, then just relax and adhere to 1.8.x. Install 1.8.x version and Practice. Same for 1.9.x and other versions. Or else you'll end up with frustration like "why doesn't my code run?".
The most important thing is RubyGem. RubyGem is also stick to ruby version. Gems that run in 1.8.x are not usually compatible with 1.9.x. So, keep that in mind. Or else you're unhappy that you install this gem and you can't call it - its objects.
Now, my practice is that I install every version. I exclude ruby path and its lib in PATH variable. When I want to switch between each version, I use BAT/bash file that set variable for each version like PATH=$PATH:/opt/ruby18 .
I've also asked many questions about this in many forums. As you know, the life and true aspect of programming is to (re)use libraries and objects. If certain libraries don't work with a certain version of ruby, then you have to switch to others. This is also my bad feeling about ruby. They really should have backward compatibility.
Maybe others can solve this problem smarter than me. But it really messed up with my programming life.
Checkout RVM, use it to install different versions of Ruby/Rails on your machine without root access. It will make your Rails development easier :)
railstutorial.org walks you through the installation of everything you need on OS X. It's also more recent than the book you're using.
Take your pick, the Rails book or the version that you specifically need to learn.
Once you decide on a book, install the versions of the language / gems as mentioned in the book. e.g. Rails 1.2 and Rails 2.0 had pretty big differences and the tutorials wouldn't work.
If you're learning Rails, pick a well known book, install the specific gems. Once you're done with the book, you'd be in a better position to look at the differences and migrate to higher versions with less hassle.
gem list rails --remote
gem install [gemname] --version [version]
精彩评论