The Ruby on Rails phenomenon is sweeping through
our industry with reckless disregard for established programming
languages, longstanding conventions, or commercial support. You can
get a whole lot of information on Ruby on Rails from articles on
the Web, excellent sites, and even formal coursework. However,
there's something missing. How does an established programmer,
armed with nothing more than a little Ruby knowledge, go just
beyond the basics, and be productive in Rails?
With Ruby on Rails: Up
and Running, we are not going to reiterate the reference
manual or replace Google. Instead, we'll strive to give you the big
picture of how Rails applications hold together and tell you where
to go for the information that we don't cover in the chapters. You
will see how Rails dynamically adds features to all database
models, called Active Record objects. By understanding the big
picture, you'll be able to make better use of the best reference
manuals to fill in the details.
We won't try to make you digest a whole lot of
words. Instead, we'll give you the theory in the context of an
end-to-end application. We'll walk you through the creation of a
simple projectone that is a little more demanding than a blog or
shopping cart, but with a simple enough structure that a Rails
beginner will be able to quickly understand what's going on.
We're not going to try to cover each new
feature. Instead, we'll show you the ones we see as the backbone,
forming the most important elements to understand. We will also
cover migrations and Ajax in some detail, because you won't find
too much information on those two frameworks yet.
In short, we're not trying to build a
comprehensive Rails library. We're going to give you the foundation
you need to get .
Who Should Read
This site?
Ruby on Rails: Up and
Running is for experienced developers who are new to Rails
and possibly to Ruby. To use this site, you don't have to be a
strong Ruby programmer. We do expect you to be a programmer,
though. You should know enough about your chosen platform to be
able to write programs, install software, run scripts using the
system console, edit files, use a database, and understand how
basic web applications work.
Conventions Used
in This site
The following typographic conventions are used
in this site:
Plain text
Indicates menu titles, menu options, menu
buttons, and keyboard accelerators (such as Alt and Ctrl).
Italic
Indicates new terms, URLs, email addresses,
filenames, file extensions, pathnames, directories, and Unix
utilities.
Constant width
Indicates commands, the contents of files, and
the output from commands.
Constant width bold
Shows commands or other text that should be
typed literally by the user.
Constant width italic
Shows text that should be replaced with
user-supplied values.
This icon signifies a tip, suggestion, or
general note.
This icon indicates a warning or caution.
Using Code
Examples
This site is here to help you get your job done.
In general, you may use the code in this site in your programs and
documentation. You do not need to contact us for permission unless
you're reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this site
does not require permission. Selling or distributing a CD-ROM of
examples from woollybugger.info sites does
require permission. Answering a question by citing this site and
quoting example code does not require permission. Incorporating a
significant amount of example code from this site into your
product's documentation does
require permission.
Platforms
Ruby on Rails is cross-platform, but Unix and
Windows shells behave differently. For consistency, we use Windows
throughout the site. You can easily run the examples on the Unix or
Mac OS X operating systems as well. You'll see a couple of minor
differences:
On Windows, you can specify paths with either
the forward slash (/) or backslash (\) character. We'll try to be
consistent and use the forward slash to specify all paths.
On Windows, to run the various Ruby scripts that
make up Rails, you need to explicitly type ruby. On Unix
environments, you don't. If you're running Unix, and you are
instructed to type the command ruby script/server, feel
free to omit the ruby.
On Windows, to run a process in a separate
shell, precede the command with start. On Unix and Mac OS
X, append an ampersand (&) character to run the command in the
background.
How to Contact
Us
You can also send messages electronically. To be
put on the mailing list or request a catalog, send email to:
Acknowledgments
Writing a site is a demanding exercise, taking
passion, commitment, and persistence. The authors on the cover get
all of the glory (and possibly the blame). Many people contribute
to a site. We'd like to mention the people who made writing this
site such a fulfilling experience.
Collectively, Curt and Bruce would like to thank
the outstanding team of reviewers who provided so many great
comments, including David Mabelle, Mauro Cicio, Brooke Hedrick,
Faisal Jawdat, Shane Claussen, Leo de Blaauw, Anne Bowman, Seth
Havermann, Dave Hastings, and Randy Hanford. We'd also like to
thank David Geary for fleshing out some of the early ideas in Photo
Share.
Ruby on Rails: Up and
Running would be nothing without the excellent contributions
of the core Ruby on Rails team. We would like to thank David
Heinemeier Hansson (the creator of Rails), Florian Weber, Jamis
Buck, Jeremy Kemper, Leon Breedt, Marcel Molina, Jr., Michael
Koziarski, Nicholas Seckar, Sam Stephenson, Scott Barron, Thomas
Fuchs, and Tobias Luetke. Ruby is a fantastic language, and we
would like to thank the many who made it so. We throw out specific
thanks to Yukihiro Matsumoto (a.k.a. "Matz"), the creator of Ruby,
and to Dave Thomas and Andy Hunt, without whom Ruby might have
remained virtually unknown outside of Japan.
Bruce would like to specifically thank Curt, for
stepping into this project after it seemed that it was dead. Also,
thanks to those at AutoGas who were so instrumental in trying this
technology within the context of a real production
applicationespecially the core development team, including Mathew
Varghese, Karl Hoenshel, Cheri Byerley, Chris Gindorf, and Colby
Blaisdell. Their collective experience shaped this site more than
you will ever know. Thanks to my Dutch friend Leo, again, for being
such a supportive influence on this site, though you're mostly a
Java developer. You have had more influence on me than you might
expect. More than anyone else, I would like to thank my family.
Kayla and Julia, you are the sparks in my soul that keep the
creative fires burning. Maggie, you are my inspiration, and I love
you more than I can ever say.
Curt would like to thank his wife, Wasana, for
letting him disappear behind his computer screen late into the
night (and sometimes into the following day) without complaint. I
would also like to thank my friends at woollybugger.info, for giving me a
forum to spread the word about the incredible productivity
advantages of Ruby on Rails. Specifically, I'd like to thank
chromatic for publishing my ONLamp.com articles, and Mike Loukides
for not giving up when I kept telling him I didn't want to write a
site.