Synopses & Reviews
If youre a web developer or designer ready to learn Rails, this unique book is the ideal way to start.
Rather than throw you into the middle of the frameworks Model-View-Controller architecture, Learning Rails 3 works from the outside in. Youll begin with the foundations of the Web you already know, and learn how to create something visible with Rails view layer. Then youll tackle the more difficult inner layers: the database models and controller code.
All you need to get started is HTML experience. Each chapter includes exercises and review questions to test your understanding as you go.
- Present content by building an application with a basic view and a simple controller
- Build forms and process their results, progressing from simple to more complex
- Connect forms to models by setting up a database, and create code that maps to database structures
- Use Rails scaffolding to build applications from a view-centric perspective
- Add common web application elements such as sessions, cookies, and authentication
- Build applications that combine data from multiple tables
- Send and receive email messages from your applications
"Learning Rails 3 feels like a brisk pair programming session with professionals who know how to use Ruby on Rails to get things done, and get them done well."
-Alan Harris, author of Sinatra: Up and Running
Synopsis
Ready to learn Rails? Unlike most Rails books, Learning Rails is for web developers, and not for programmers. Rather than begin with the inner layers of a Rails web application—the models and controllers—this book approaches Rails development from the outer layer: the view side of an application. Youll start from the foundations of the Web you already know, and learn how to create something visible with Rails before reaching the more difficult database models and controller code. Each chapter includes exercises and review questions so you can test your understanding as you go.
- Present content by building an application with a basic view and a simple controller, while learning Ruby along the way
- Build forms and process their results, progressing from simple to more complex
- Connect forms to models by setting up a database, and use Rails Active Record to create code that maps to database structures
- Use Rails scaffolding to build applications from a view-centric perspective
- Add common web application elements such as sessions, cookies, and authentication
- Build applications that combine data from multiple tables
- Create simple but dynamic interfaces with Rails and Ajax
Learning Rails 3 covers the most recent developments.
About the Author
Simon St. Laurent is Senior Editor at O'Reilly Media, Inc., focusing primarily on JavaScript and web-related projects. He co-chairs OSCON and the Fluent conference. He's authored or co-authored books including Introducing Erlang, Learning Rails 3, XML Pocket Reference, 3rd, XML: A Primer, and Cookies.
You can find more of his writing on technology, Quakerism, and the Town of Dryden at simonstl.com.
Edd Dumbill is a technologist, writer and programmer based in California. He is the program chair for the OReilly Strata and OpenSource Convention Conferences.
Eric J. Gruber makes stuff for the web and is the eGov coordinator for Lawrence, KS.
Table of Contents
Preface; Who This Book Is For; Who This Book Is Not For; What You'll Learn; Ruby and Rails Style; Other Options; Rails Versions; If You Have Problems Making Examples Work; If You Like (or Don't Like) This Book; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Starting Up Ruby on Rails; 1.1 If You Run Windows, You're Lucky; 1.2 Getting Started at the Command Line; 1.3 Starting Up Rails; 1.4 Test Your Knowledge; Chapter 2: Rails on the Web; 2.1 Creating Your Own View; 2.2 What Are All Those Folders?; 2.3 Adding Some Data; 2.4 How Hello World Works; 2.5 Adding Logic to the View; 2.6 Test Your Knowledge; Chapter 3: Adding Web Style; 3.1 I Want My CSS!; 3.2 Specifying Stylesheets; 3.3 Creating a Layout for a Controller; 3.4 Choosing a Layout from a Controller; 3.5 Sharing Template Data with the Layout; 3.6 Setting a Default Page; 3.7 Test Your Knowledge; Chapter 4: Managing Data Flow: Controllers and Models; 4.1 Getting Started, Greeting Guests; 4.2 Application Flow; 4.3 Keeping Track: A Simple Guestbook; 4.4 Finding Data with ActiveRecord; 4.5 Test Your Knowledge; Chapter 5: Accelerating Development with Scaffolding and REST; 5.1 A First Look at Scaffolding; 5.2 REST and Controller Best Practices; 5.3 Examining a RESTful Controller; 5.4 Escaping the REST Prison; 5.5 Test Your Knowledge; Chapter 6: Presenting Models with Forms; 6.1 More Than a Name on a Form; 6.2 Generating HTML Forms with Scaffolding; 6.3 Form as a Wrapper; 6.4 Creating Text Fields and Text Areas; 6.5 Labels; 6.6 Creating Checkboxes; 6.7 Creating Radio Buttons; 6.8 Creating Selection Lists; 6.9 Dates and Times; 6.10 Creating Helper Methods; 6.11 Test Your Knowledge; Chapter 7: Strengthening Models with Validation; 7.1 Without Validation; 7.2 The Original Model; 7.3 The Power of Declarative Validation; 7.4 Managing Secrets; 7.5 A Place on the Calendar; 7.6 Beyond Simple Declarations; 7.7 Test Your Knowledge; Chapter 8: Improving Forms; 8.1 Adding a Picture by Uploading a File; 8.2 Standardizing Your Look with Form Builders; 8.3 Test Your Knowledge; Chapter 9: Developing Model Relationships; 9.1 Connecting Awards to Students; 9.2 Connecting Students to Awards; 9.3 Nesting Awards in Students; 9.4 Many-to-Many: Connecting Students to Courses; 9.5 What's Missing?; 9.6 Test Your Knowledge; Chapter 10: Managing Databases with Migrations; 10.1 What Migrations Offer You; 10.2 Migration Basics; 10.3 Inside Migrations; 10.4 Test Your Knowledge; Chapter 11: Debugging; 11.1 Creating Your Own Debugging Messages; 11.2 Raising Exceptions; 11.3 Logging; 11.4 Working with Rails from the Console; 11.5 The Ruby Debugger; 11.6 Test Your Knowledge; Chapter 12: Testing; 12.1 Test Mode; 12.2 Setting Up a Test Database with Fixtures; 12.3 Unit Testing; 12.4 Functional Testing; 12.5 Integration Testing; 12.6 Beyond the Basics; 12.7 Test Your Knowledge; Chapter 13: Sessions and Cookies; 13.1 Getting Into and Out of Cookies; 13.2 Storing Data Between Sessions; 13.3 Test Your Knowledge; Chapter 14: Users and Authentication; 14.1 Installation; 14.2 Storing Identities; 14.3 Storing User Data; 14.4 Wiring OmniAuth into the Application; 14.5 Classifying Users; 14.6 More Options; 14.7 Test Your Knowledge; Chapter 15: Routing; 15.1 Creating Routes to Interpret URIs; 15.2 Generating URIs from Views and Controllers; 15.3 Infinite Possibilities; 15.4 Test Your Knowledge; Chapter 16: From CSS to SASS; 16.1 Getting Started; 16.2 Sassy Style; 16.3 Making Everything Work Together; 16.4 Test Your Knowledge; Chapter 17: Managing Assets and Bundles; 17.1 The Junk Drawer; 17.2 Test Your Knowledge; Chapter 18: Sending Code to the Browser: JavaScript and CoffeeScript; 18.1 Sending JavaScript to the Browser; 18.2 Simplifying with CoffeeScript; 18.3 Test Your Knowledge; Chapter 19: Mail in Rails; 19.1 Sending Mail Messages; 19.2 Receiving Mail; 19.3 Test Your Knowledge; Chapter 20: Pushing Further into Rails; 20.1 Changing to Production Mode; 20.2 Deploying Is Much More Than Programming; 20.3 Joining the Rails Ecosystem; An Incredibly Brief Introduction to Ruby; How Ruby Works; How Rails Works; Getting Started with Classes and Objects; Comments; Variables, Methods, and Attributes; Logic and Conditionals; An Incredibly Brief Introduction to Relational Databases; Tables of Data; Databases, Tables, and Rails; An Incredibly Brief Guide to Regular Expressions; What Regular Expressions Do; Starting Small; The Simplest Expressions: Literal Strings; Character Classes; Escaping; Modifiers; Anchors; Sequences, Repetition, Groups, and Choices; Greed; More Possibilities; Glossary; Speaking in Rails; Colophon;