Product Overview
Looking for the old edition of “Simply Rails 2?”
Download the code archive or view errata of the old edition here.
Simply Rails 2
Table Of Contents
- Here’s a look at the table of contents:
- Preface
- Who Should Read This Book?
- What You’ll Learn
- What’s in This Book?
- The Book’s Web Site
- The Code Archive
- Updates and Errata
- The SitePoint Forums
- The SitePoint Newsletters
- Your Feedback
- Conventions Used in This Book
- Code Samples
- Tips, Notes, and Warnings
- Acknowledgments
- Chapter 1. Introducing Ruby on Rails
- History
- Development Principles
- Convention Over Configuration
- Don’t Repeat Yourself
- Agile Development
- Building the Example Web Application
- What Is Digg?
- Features of the Example Application
- Summary
- Chapter 2. Getting Started
- What Does All This Cost?
- Installing on Windows
- Installing on Mac OS X
- Mac OS X 10.5 (Leopard)
- Mac OS X 10.4 (Tiger) and Earlier
- Installing on Linux
- Using a Package Manager
- Prerequisites
- Installing Ruby on Linux
- Installing RubyGems on Linux
- Installing Rails on Linux
- Installing SQLite on Linux
- Installing the SQLite Database Interface for Ruby
- Building a Foundation
- One Directory Structure to Rule Them All
- Creating the Standard Directory Structure
- Starting Our Application
- Which Text Editor?
- Windows Text Editors
- Mac OS X Text Editors
- Linux and Cross-platform Editors
- Summary
- Chapter 3. Introducing Ruby
- Ruby Is a Scripting Language
- Compiled Languages
- Scripting Languages
- The Great Performance Debate
- Ruby Is an Object Oriented Language
- Reading and Writing Ruby Code
- The Interactive Ruby Shell (
- Interacting with Ruby Objects
- Punctuation in Ruby
- Object Oriented Programming in Ruby
- Classes and Objects
- Object-level Functionality
- Class-level Functionality
- Inheritance
- Return Values
- Standard Output
- Ruby Core Classes
- Arrays
- Hashes
- Strings
- Numerics
- Symbols
- nil
- Running Ruby Files
- Control Structures
- Conditionals
- Loops
- Blocks
- Summary
- Ruby Is a Scripting Language
- Chapter 4. Rails Revealed
- Three Environments
- Database Configuration
- The Database Configuration File
- The Model-View-Controller Architecture
- MVC in Theory
- MVC the Rails Way
- (the Model)
- The
- The REST
- Code Generation
- ActionMailer
- Testing and Debugging
- Testing
- Debugging
- Summary
- Chapter 5. Models, Views, and Controllers
- Generating a Model
- The Model Generator
- Modifying the Schema Using Migrations
- Managing Data Using the Rails Console
- Where’s the SQL?
- Generating a Controller
- Running the
- Understanding the Output
- Starting Our Application … Again
- Creating a View
- Generating Views with Scaffolding
- Creating Static Pages
- Creating Dynamic Pages
- Passing Data Back and Forth
- Pulling in a Model
- Summary
- Generating a Model
- Chapter 6. Helpers, Forms, and Layouts
- Calling upon Our Trusty Helpers
- Enabling Story Submission
- Creating a Form
- Saving Data to the Database
- Redirecting with URL helpers
- Creating a Layout
- Enabling User Feedback with the Flash
- Testing the Form
- Testing the Model
- Testing the Controller
- Revisiting the Logs
- Summary
- Chapter 7. Ajax and Web 2.0
- Generating a Vote Model
- Creating the Model
- Examining the Vote Migration
- Applying the Migration
- Introducing Relationships
- Introducing the
- Introducing the
- How’s Our Schema Looking?
- Making a Home for Each Story
- Determining Where a Story Lives
- Displaying Our Stories
- Improving the Story Randomizer
- Implementing Clean URLs
- Ajax and Rails
- Introducing Ajax
- Remote Scripting with Prototype
- Adding Visual Effects with script.aculo.us
- Making Stories Shove-able
- Introducing Partials
- Adding Voting History
- Creating the Partial
- Styling the Voting History
- Tweaking the Voting History
- Testing the Voting Functionality
- Testing the Model
- Testing the Controller
- Running the Full Test Suite
- Summary
- Generating a Vote Model
- Chapter 8. Protective Measures
- Introducing Sessions and Cookies
- Identifying Individual Users
- What’s a Cookie?
- What’s a Session?
- Sessions in Rails
- Modeling the User
- Generating a User Model
- Adding Relationships for the
- Creating a User
- Developing Login Functionality
- Creating the Controller
- Creating the View
- Adding Functionality to the Controller
- Introducing Filters
- Before Filters
- After Filters
- Around Filters
- A Word on Filter Methods
- Managing User Logins
- Retrieving the Current User
- Displaying the Name of the Current User
- Allowing Users to Log Out
- Adding a Navigation Menu
- Restricting the Application
- Protecting the Form
- Restricting Access to Story Submission
- Associating Stories with Users
- Testing User Authentication
- Testing the Model
- Testing the Controllers
- Summary
- Introducing Sessions and Cookies
- Chapter 9. Advanced Topics
- Promoting Popular Stories
- Using a Counter Cache
- Implementing the Front Page
- Implementing the Voting Bin
- Adding Custom Actions to RESTful Routes
- Abstracting Presentation Logic
- Requiring a Login to Vote
- Auto-voting for Newly Submitted Stories
- Introducing Model Callbacks
- Adding a Callback
- Adding a Description to Stories
- Adding a Model Attribute
- Expanding the Submission Form
- Adding User Pages
- Introducing the Join Model Relationship
- Introducing the
- Adding Another Controller
- Creating the View
- Testing the New Functionality
- Testing the Model
- Testing the StoriesController
- Testing the VotesController
- Testing the UsersController
- Running the Complete Test Suite
- Summary
- Promoting Popular Stories
- Chapter 10. Rails Plugins
- What Is a Plugin?
- Adding Tagging to Shovell
- Introducing the
- Enabling Tag Submission
- Enabling Tag Display
- Assigning Our First Tags
- Viewing Stories by Tag
- Testing the Tagging Functionality
- Testing the Model
- Testing the Controller
- Running the Test Suite ... Again!
- Summary
- Chapter 11. Debugging, Testing, and Benchmarking
- Debugging Your Application
- Debugging within Templates
- Debugging using ruby-debug
- Using the Rails Logging Tool
- Overcoming Problems in Debugging
- Testing Your Application
- Integration Tests
- Using Breakpoints in a Test
- Revisiting the Rails Console
- Benchmarking Your Application
- Taking Benchmarks from Log Files
- Manual Benchmarking
- Summary
- Debugging Your Application
- Chapter 12. Deployment and Production Use
- The Implications of “Production”
- Choosing a Production Environment
- Web Server Options
- Back-end Options
- Deploying Shovell
- Moving to the Production System
- Setting up Apache
- Alternatives for Session Storage
- The
- The
- Further Reading
- Caching
- Version Control and Deployment Management
- Errors by Email
- Summary
- Index