Updated: Sept. 5, 2013

All of our online courses start with comprehensive instructions for getting the required software installed and set up on your own computer. For the online Rails course, that means installing Ruby and Rails. During the course, you'll then write, refactor, and test your code directly on your own computer. That way, after the course, you'll already be familiar with the environment where you can then start writing your own Rails apps!

Setting up a stable Ruby and Rails environment on Windows has never been easier. Here's our recommended approach…

Install Ruby and Rails

The easiest way we've found to install Ruby, Rails, and other supporting software on Windows is using the RailsInstaller. It's a self-contained Windows installer (an .exe file) that includes a Ruby language execution environment, a baseline version of Rails, and other useful goodies such as Git, SQLite, and the Windows DevKit.

  1. On the RailsInstaller page, click the big green "Windows Ruby 1.9" button to download the installer.

  2. Once the executable installer has downloaded, use Windows Explorer to navigate to where you saved the .exe file and double-click it to start the installation process.

  3. After stepping through a couple standard installer screens, you'll be prompted for the installation destination. By default, RailsInstaller will be installed in your C:\RailsInstaller directory. We'll assume you go with the default destination.

  4. When the installation is complete, a command prompt window will open and prompt for your name and email. Then you'll end up in the C:\Sites directory. You should see a window with a blinking cursor and a prompt that looks something like this:

    C:\Sites>
    

    If this is the first time you've seen this command prompt it may seem rather intimidating, but don't let it throw you. It's simply a way to interact with your computer by entering commands. In fact, here comes our first command...

  5. Open a new command prompt by selecting Start -> Run... and typing cmd into the dialog box. You should see a new window with a blinking cursor and a prompt that looks something like this:

    C:\Users\mike>
    
  6. Verify that Ruby 1.9.3 was successfully installed by typing

    ruby -v
    

    Ruby should reply with

    ruby 1.9.3p392 (2013-02-22) [i386-mingw32]
    
  7. Next, update Rails to the latest version by typing

    gem update rails
    

    Then sit back and relax as RubyGems downloads all the Rails-related gems and assembles the documentation. After a few minutes, you should end up with a dozen or so gems installed. If you see a warning about "file 'lib' not found" while it's generating documentation, don't worry about.

  8. Finally, verify that the latest version of Rails was successfully installed by typing

    rails -v
    

    Rails should answer with 4.0.0 or higher.

Create An Example Rails App

Now that we have all the required software installed, let's create your first Rails app to make sure everything is working in harmony. We'll create a simple application for managing a list of todos.

  1. From a command prompt, navigate to a directory where you want the application code to live (your C:\work directory, for example).

  2. Start by creating an empty Rails application called todos:

    rails new todos
    
  3. Change into the todos directory that was created in the previous step:

    cd todos
    
  4. The application doesn't know about todos yet, so we'll use scaffolding to quickly generate all the code for managing a list of todos. Run the scaffold generator by typing

    rails g scaffold todo name:string due_on:date completed:boolean
    

    You'll see Rails create a bunch of files, including a migration file for creating a database schema to store todo items in a database (SQLite3 in this case).

  5. Run the database migration by typing

    rake db:migrate
    
  6. Then start the Rails app by typing

    rails s
    
  7. Finally, point your web browser at http://localhost:3000 and you should see a page welcoming you to Rails. To start managing your todos, go to http://localhost:3000/todos.

  8. When you're done, you can stop the Rails app by typing CTRL-C in the command prompt where you started the app.

Next Steps

That's all there is to it! Now you have everything you need to start building your own Rails apps. And that's exactly how we recommend you start learning Rails, by actually building something, whether it be for fun or profit.

If you're not sure how to get started building Rails apps, consider taking our online Rails course. You'll learn how to build a complete Rails app step-by-step, from idea to deployment. Along the way you'll learn the tips, tricks, and best practices used by experienced Rails developers to build high-quality Rails apps quickly. You'll come away with a solid understanding of the fundamentals of Rails, and how to put all the pieces together, so you can confidently create your first Rails app or jump right into an existing app!

Learn Rails in this online, self-paced course!

36 Videos Unlimited Access
Hands-On Exercises Support Mailing List
2 Example Apps Proof of Completion
Cheat Sheets Alumni Status
Buy Now