You are previewing Building Dynamic Web 2.0 Websites with Ruby on Rails.
O'Reilly logo
Building Dynamic Web 2.0 Websites with Ruby on Rails

Book Description

Create database-driven dynamic websites with this open-source web application framework

  • Create a complete Web 2.0 application with Ruby on Rails

  • Learn rapid web development

  • Enhance your user interface with AJAX

In Detail

Ruby on Rails is an open-source web application framework ideally suited to building business applications; accelerating and simplifying the creation of database-driven websites. Often shortened to Rails or RoR, it provides a stack of tools to rapidly build web applications based on the Model-View-Controller design pattern.

This book is a tutorial for creating a complete website with Ruby on Rails. It will teach you to develop database-backed web applications according to the Model-View-Controller pattern. It will take you on a joy ride right from installation to a complete dynamic website. All the applications discussed in this book will help you add exciting features to your website. This book will show you how to assemble RoR's features and leverage its power to design, develop, and deploy a fully featured website. Each chapter adds a new feature to the site, adding new knowledge, skills, and techniques.

Table of Contents

  1. Building Dynamic Web 2.0 Websites with Ruby on Rails
  2. Credits
  3. About the Author
  4. About the Reviewer
  5. Preface
    1. What This Book Covers
    2. What You Need for This Book
    3. Conventions
    4. Reader Feedback
    5. Customer Support
      1. Downloading the Example Code for the Book
      2. Errata
      3. Questions
  6. 1. Getting Started with Ruby and RoR
    1. Ruby and RoR—The Next Level in Dynamic Web Development
      1. Ruby
      2. Ruby on Rails (RoR)
        1. Philosophy
        2. Features
    2. Installing and Configuring Ruby and RoR
      1. Manual Installation
        1. Downloading and Installing Ruby
        2. Updating Gem
        3. Installing RoR
      2. One-Click RoR Installation
        1. Download and Unzip the Instant Rails
        2. Configure Instant Rails Installation
    3. Testing the Installation
      1. Ruby
      2. RoR
    4. Summary
  7. 2. Getting to Know Ruby and RoR
    1. Ruby—the Basics
      1. Classes, Attributes, Methods, and Objects
        1. Classes
        2. Attributes
        3. Methods
        4. Objects
        5. Inheritance
        6. Modules
      2. Data Types
        1. Number
        2. Float
        3. String
      3. Blocks and Iterators
        1. Blocks
        2. Iterators
      4. Exception Handling
      5. Data Structures
        1. Arrays
        2. Hashes
    2. RoR—Concepts and Components
      1. RoR is a Ruby-Based Framework
      2. RoR Implements MVC Pattern
        1. Active Record
        2. Action View
        3. Action Controller
    3. Hello World—the RoR Way
      1. Setting up the Application Structure
      2. Adding the First Controller Class
      3. Defining the Action Method
      4. Adding the View Template
      5. Testing the Application
    4. Summary
  8. 3. TaleWiki—The Basic Setup
    1. Understanding the Requirements
      1. System Requirements
      2. Module-Specific Requirements
        1. Managing the Stories
      3. Designing the Database
        1. Understanding the Conventions
        2. Designing the E-R Model
        3. Defining the Schema
        4. Creating the Tables
      4. TaleWiki—Developing the Tale Management Module
        1. Creating the Application Structure
        2. Generating the Scaffolds
        3. Customizing the Model
          1. Relationship Mapping
          2. Data Validation
        4. Customizing the Controller
        5. Refining the View
          1. Refining the New Tale Template
          2. Refining the Edit Tale Template
      5. Testing the Application
    2. Summary
  9. 4. Managing the Users
    1. Understanding the Requirements
      1. Managing the User
        1. Managing Roles
      2. Designing the Tables
        1. Designing the E-R Model
        2. Deriving the Schema
        3. Creating the Tables
      3. Developing the User Management
        1. Developing the Role Management
          1. Generating the Scaffolds
          2. Modifying the Model
          3. Customizing the Controller
          4. Refining the View
        2. Developing the User Management Functionality
          1. Generating the Scaffold
          2. Modifying the Model
          3. Assigning Default Role to a User
          4. Adding Display Action Method to the Controller
          5. Refining the View
          6. Adding the Assign Method to the Controller
      4. Testing the Functionalities
    2. Summary
  10. 5. Gathering User Comments
    1. Understanding the Requirements
      1. Login Management
      2. Managing the Comments
      3. Designing the Database
        1. Designing the E-R Model
        2. Deriving the Schema
        3. Creating the Tables
      4. Developing the Login Management Module
        1. Creating the Login Page
        2. Implementing the Authenticate method
          1. Model
          2. Controller
        3. Setting up the Session
        4. Applying Authorization
        5. Tying Up the Loose Ends
      5. Developing the Comment Management Module
        1. Generating the Scaffold
        2. Modifying the Model
        3. Refining the View
        4. Customizing the Controller
      6. Testing the Module
    2. Summary
  11. 6. Setting up the Template
    1. Understanding Migration
      1. Generating Migration Classes
      2. Editing the Generated Classes
      3. Running the Migration
    2. Customizing the Template
      1. Defining the Layout
        1. Customizing the Layout of the Login Page
        2. Defining the Master Layout
          1. Defining and Applying the Master Layout
      2. Setting up the Navigation
      3. Testing the Application
    3. Summary
  12. 7. Tagging the Tales
    1. Understanding the Requirements
    2. Developing the Tag management Module
      1. Selecting a Plug-in for Tag Management
      2. Installing the Plug-in
      3. Setting up Tables Required by the Plug-in
      4. Developing the Tag Management Module
        1. Adding a Tag
        2. Visualizing the Tag Cloud
        3. Searching By Tag
        4. Testing the Modifications
    3. Summary
  13. 8. Enhancing User Experience with Ajax
    1. Understanding the Requirements
    2. Implementing Ajax
      1. What is Ajax?
      2. How Ajax and RoR are Related
      3. Implementing the Live Search
        1. Specify the Location to Display the Result
        2. Use the observe_field Helper
        3. Modify the Action Method
      4. Implementing the In-line Editing
        1. Marking the Fields for In-line Editing
        2. Set up the Controller
      5. Testing the Modifications
    3. Summary
  14. 9. Developing the Interface for Administration
    1. Understanding the Requirements
    2. Implementing the Functionalities
      1. Modification of the Deletion of Tales
      2. Providing Access to All the Functionalities of the Comment Management Module
      3. Implementing Auto-Complete for the User name
      4. Implementing Search
      5. Testing the Modifications
    3. Summary
  15. 10. Deploying the TaleWiki
    1. Understanding the Production Environment
      1. Development Mode
      2. Test Mode
      3. Production Mode
    2. Changing to the Production Environment
      1. Migrating to the Production Database
      2. Configuring Mongrel
    3. Points to Consider
    4. Summary