Contents 

Ruby on Rails:
Table of Contents
Preface
Zero to Sixty: Introducing Rails
1.1. Rails Strengths
1.2. Putting Rails into Action
1.3. Organization
1.4. The Web Server
1.5. Creating a Controller
1.6. Building a View
1.7. Tying the Controller to the View
1.8. Under the Hood
1.9. What's Next?
Active Record Basics
2.1. Active Record Basics
2.2. Introducing Photo Share
2.3. Schema Migrations
2.4. Basic Active Record Classes
2.5. Attributes
2.6. Complex Classes
2.7. Behavior
2.8. Moving Forward
Active Record Relationships
3.1. belongs_to
3.2. has_many
3.3. has_one
3.4. What You Haven't Seen
3.5. Looking Ahead
Scaffolding
4.1. Using the Scaffold Method
4.2. Replacing Scaffolding
4.3. Generating Scaffolding Code
4.4. Moving Forward
Extending Views
5.1. The Big Picture
5.2. Seeing Real Photos
5.3. View Templates
5.4. Setting the Default Root
5.5. Stylesheets
5.6. Hierarchical Categories
5.7. Styling the Slideshows
Ajax
6.1. How Rails Implements Ajax
6.2. Playing a Slideshow
6.3. Using Drag-and-Drop to Reorder Slides
6.4. Drag and Drop Everything (Almost Everything)
6.5. Filtering by Category
Testing
7.1. Background
7.2. Ruby's Test::Unit
7.3. Testing in Rails
7.4. Wrapping Up
Installing Rails
1.1. Windows
2.1. OS X
3.1. Linux
Quick Reference
5.1. General
5.2. Testing
5.3. RJS (Ruby JavaScript)
5.4. Active Record
5.5. Controllers
5.6. Views
5.7. Ajax
5.8. Configuring Your Application
About the Authors
Colophon
Index
A
B
C
D
E
F
G
H
I
J
L
M
N
O
P
R
S
T
U
V
W
X
Y
Z

Ruby on Rails manual

Prev Page Next Page
Previous Page
Next Page

1.1. Windows

We present two options for a Windows installation of Ruby on Rails: Instant Rails and RadRails alone and Instant Rails plus the Rad Rails IDE.

1.1.1. Instant Rails

The easiest way to get started on Windows is to use Instant Rails. Instant Rails ( "#rubyrails-app-a-fig-1">Figure A-1) is a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run. There is no installer, you simply unzip it into the directory of your choice and run it. It does not modify your system environment.

Figure A-1. Instant Rails

For more details about Instant Rails, go to the Instant Rails home page at http://instantrails.rubyforge.org:

  1. Download and unzip the latest version of the Instant Rails ZIP file from: http://rubyforge.org/frs/?group_id=904.

  2. Make sure that the installation path (to the directory into which you unzip the archive) does not contain any space characters, and then start InstantRails.exe.

  3. Instant Rails will detect that it is being started from a new directory and ask whether you want to have it update the paths in the all of the configuration files. Click Yes.

  4. Click on the "I" button (or press the Alt key twice) to display the main menu.

That's all there is to it!

Instant Rails includes the cooksite Rails application from the ONLamp.com article "Rolling with Ruby on Rails" (onlamp.com/pub/a/onlamp/2005/01/20/rails.html">http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html). The cooksite application is included as a preinstalled sample application. There is also a version of this tutorial that was rewritten to be specific to Instant Rails available at http://instantrails.rubyforge.org/wiki/wiki.pl?Rolling_With_Ruby_On_Instant_Rails_Tutorial. Instant Rails also includes the Photo Share application from this site.

Instant Rails includes the Apache web server, which you won't use until later in the development of a Rails application, when you want to more closely duplicate your final deployment environment. During development, it is easiest use Ruby's built-in web server, WEBrick, or the new Ruby Mongrel server.

So, for example, to run the cooksite application, execute the Instant Rails menu command Rails Applications Manage Rails Applications..., select the checkbox next to the cooksite application, and press the "Start with WEBrick" button. When you browse to http://127.0.0.1:3000/, you will see the cooksite application.

Instant Rails includes the One-Click Ruby Installer for Windows for its Ruby interpreter, which includes the SciTE text editor with full Ruby syntax highlighting. After installing Instant Rails, you can find the SciTE executable at InstantRails/ruby/scite/SciTE.exe.

1.1.2. RadRails

If you want more than a simple text editor, then try out the excellent RadRails IDE. RadRails (Figure A-2) is an Eclipse plug-in and is available as both a standalone IDE (Eclipse with the plug-in preinstalled) and as a standard Eclipse plug-in at http://www.radrails.org. With RadRails, you get a full IDE, complete with an integrated GUI debugger.

Figure A-2. RadRails

After you install RadRails, you have to configure it to work with your Instant Rails installation:

  1. Execute the menu command Window Preferences.

  2. Select Ruby Installed Interpreters.

  3. Click the Add button, and give the new interpreter instance a name (like "Instant Rails Ruby"); browse to the Ruby executable at InstantRails/ruby/bin/ruby.exe, and click OK.

  4. While still in the preferences dialog, select Ruby->Ri/rdoc and set the Rdoc and Ri paths to InstantRails/ruby/bin/rdoc and InstantRails/ruby/bin/ri, respectively. This step lets you use the built-in documentation features of RadRails.

You can create a new skeleton Rails application via the menus with File New... Rails RailsProject.


Previous Page
Next Page