Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596101329/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Preface
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 books, 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 up and running.
Who Should Read This Book?
Ruby on Rails: Up and Running is for experienced developers who are new to Rails and possibly to Ruby. To use this book, 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 Book
The following typographic conventions are used in this book:
Plain text
Indicates menu titles, menu options, menu buttons, and keyboard accelerators (such as Alt and Ctrl).
ItalicIndicates 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.
Tip
This icon signifies a tip, suggestion, or general note.
Warning
This icon indicates a warning or caution.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book 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 book does not require permission. Selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product's documentation does require permission.
You can get sample code at the main page for Ruby on Rails: Up and Running : http://www.oreilly.com/catalog/rubyrails/. You will find a ZIP file that contains the sample project as it exists after each chapter, with each instance of the sample application numbered by chapter. If you want to skip a chapter, just download the right ZIP file.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: " Ruby on Rails: Up and Running by Bruce A. Tate and Curt Hibbs. Copyright 2006 O'Reilly Media, Inc., 978-0-596-10132-9."
If you feel that your use of code examples falls outside fair use or the permission given here, feel free to contact us at .
Platforms
Ruby on Rails is cross-platform, but Unix and Windows shells behave differently. For consistency, we use Windows throughout the book. 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.
Safari Enabled
When you see a Safari Enabled icon on the cover of your favorite technology book, that means the book is available online through the O'Reilly Network Safari Bookshelf.
Safari offers a solution that's better than e-books. It's a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://safari.oreilly.com.
How to Contact Us
We have tested and verified the information in this book and in the source code to the best of our ability, but given the amount of text and the rapid evolution of technology, you may find that features have changed or that we have made mistakes. If so, please notify us by writing to:
O'Reilly Media, Inc.
1005 Gravenstein Highway North