Windows Users:
If you're using Windows, follow the instructions below to install Ruby, Rails, and Git instead of the ones on page xxii. Throughout the book, when asked to enter commands such as bin/rake
and bin/rails
, add ruby
before those commands (for example, ruby bin/rake
and ruby bin/rails
).
Windows Installation Instructions:
You’ll use RubyInstaller to install Ruby. Download the RubyInstaller and the matching Development Kit here.
First, click the latest Ruby version on the RubyInstaller download page to download the installer; at the time of writing, it’s 2.1.5. Then scroll down to the section labeled Development Kit and click the link under your version of Ruby to download the Development Kit. As of this writing, for Ruby 2.1, you’d choose DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe. If you are using a 64-bit version of Windows, then download the 64-bit version of the installer and the matching 64-bit Development Kit, currently DevKit-mingw64-64-4.7.2-20130224-1151-sfx.exe.
Once these downloads finish, double-click the RubyInstaller file and then follow the prompts on your screen to install Ruby. Be sure to check the box next to Add Ruby executables to your PATH. Once that is complete, double-click the DevKit file and enter the path C:\DevKit to extract the files. Now open a command prompt and enter the following commands to install the Development Kit:
$ cd C:\DevKit
$ ruby dk.rb init
$ ruby dk.rb install
Some users see SSL errors when trying to install gems. Updating to the latest version of the gem
command corrects these errors. Enter the following command to update your version of gem
:
$ gem update --system –-clear-sources –-source http://rubygems.org
Once you’ve installed Ruby and the Development Kit, install Rails by entering gem install rails
. This will connect to the RubyGems server and then download and install the various packages that make up the Ruby on Rails framework.
Finally, download the latest version of Git and double-click the file to complete the installation.
Page 12:
The three examples should read as follows:
_____________________________________
irb(main):053:0> name = "Tony"
=> "Tony"
irb(main):054:0> if !name.empty?
irb(main):055:1> puts name
irb(main):056:1> end
Tony
=> nil
_____________________________________
_____________________________________
irb(main):057:0> name = "Tony"
=> "Tony"
irb(main):058:0> unless name.empty?
irb(main):059:1> puts name
irb(main):060:1> end
Tony
=> nil
_____________________________________
_____________________________________
irb(main):061:0> name = "Tony"
=> "Tony"
irb(main):062:0> puts name unless name.empty?
Tony
=> nil
_____________________________________