Agile Web Development with Rails 4



Similar documents
The Cucumber Book. Extracted from: Behaviour-Driven Development for Testers and Developers. The Pragmatic Bookshelf

icloud for Developers

Web Development Recipes

Practical Programming, 2nd Edition

Do Less, Accomplish More with Lean Thinking

Rapid Android Development

Copyright 2010 The Pragmatic Programmers, LLC.

Rails Cookbook. Rob Orsini. O'REILLY 8 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo

Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language The amazing productivity claims of Rails is

Pragmatic Version Control

Ruby on Rails. Object Oriented Analysis & Design CSCI-5448 University of Colorado, Boulder. -Dheeraj Potlapally

Enterprise Recipes with Ruby and Rails

Copyright 2008 The Pragmatic Programmers, LLC.

Novell ZENworks 10 Configuration Management SP3

Ruby On Rails. CSCI 5449 Submitted by: Bhaskar Vaish

Outline. Lecture 18: Ruby on Rails MVC. Introduction to Rails

Elgg 1.8 Social Networking

Programming Cocoa with Ruby Create Compelling Mac Apps Using RubyCocoa

System Requirements for Microsoft Dynamics NAV 2013 R2

Web Development Frameworks

Agile Web Development with Rails, Chapter 11: Task F: Add a Dash of Ajax

Adobe Acrobat 9 Deployment on Microsoft Windows Group Policy and the Active Directory service

1 What Are Web Services?

An Introduction to the Development of Web Applications using Ruby on Rails with Ajax

tibbr Now, the Information Finds You.

Using Ruby on Rails for Web Development. Introduction Guide to Ruby on Rails: An extensive roundup of 100 Ultimate Resources

7.0 SP1 Terminal Services and Citrix Support Guide

An Oracle White Paper May Creating Custom PDF Reports with Oracle Application Express and the APEX Listener

CA Workload Automation Agent for Microsoft SQL Server

Site Store Pro. INSTALLATION GUIDE WPCartPro Wordpress Plugin Version

Copyright 2014 SolarWinds Worldwide, LLC. All rights reserved worldwide. No part of this document may be reproduced by any means nor modified,

Guide to Operating SAS IT Resource Management 3.5 without a Middle Tier

SapphireIMS Business Service Monitoring Feature Specification

QAD Enterprise Applications. Training Guide Demand Management 6.1 Technical Training

Evaluation. Chapter 1: An Overview Of Ruby Rails. Copy. 6) Static Pages Within a Rails Application

NDK: Novell edirectory Core Services. novdocx (en) 24 April Novell Developer Kit. NOVELL EDIRECTORY TM CORE SERVICES.

SDK Code Examples Version 2.4.2

How To Load Data Into An Org Database Cloud Service - Multitenant Edition

User Document. Adobe Acrobat 7.0 for Microsoft Windows Group Policy Objects and Active Directory

Business Intelligence Tutorial

Getting Started Guide. Getting Started With Quick Shopping Cart. Setting up and configuring your online storefront.

PDG Shopping Cart 4.0. Quick Start Guide

SOA, case Google. Faculty of technology management Information Technology Service Oriented Communications CT30A8901.

Using the vcenter Orchestrator Plug-In for vsphere Auto Deploy 1.0

StarWind iscsi SAN Software: Using with Citrix XenServer

Administration Quick Start

SAAS BASED INVENTORY MANAGEMENT SYSTEM WHITE PAPER

Fact Sheet In-Memory Analysis

Windows Scheduled Tasks Management Pack Guide for System Center Operations Manager. Published: 07 March 2013

Steps to Migrating to a Private Cloud

TIBCO Spotfire Automation Services 6.5. User s Manual

Open EMS Suite. O&M Agent. Functional Overview Version 1.2. Nokia Siemens Networks 1 (18)

An Esri White Paper June 2010 Tracking Server 10

Pete Helgren Ruby On Rails on i

StarterPak: HubSpot and Dynamics CRM Lead and Contact Synchronization

NS DISCOVER 4.0 ADMINISTRATOR S GUIDE. July, Version 4.0

McAfee VirusScan Enterprise for Linux Software

SapphireIMS 4.0 BSM Feature Specification

Synchronization Agent Configuration Guide

PrintShop Mail Web. Release Notes

M86 Authenticator USER GUIDE. Software Version: Document Version:

The Recipe for Sarbanes-Oxley Compliance using Microsoft s SharePoint 2010 platform

Deciding When to Deploy Microsoft Windows SharePoint Services and Microsoft Office SharePoint Portal Server White Paper

AvePoint Meetings for SharePoint Online. Configuration Guide

DOCUMENTATION MICROSOFT SQL BACKUP & RESTORE OPERATIONS

SaaS Based Inventory Management System For US Based Client

Decision Support System Software Asset Management (SAM)

Orientation Course - Lab Manual

User Guide. DocAve Lotus Notes Migrator for Microsoft Exchange 1.1. Using the DocAve Notes Migrator for Exchange to Perform a Basic Migration

Jobs Guide Identity Manager February 10, 2012

TIBCO Spotfire Automation Services 6.5. Installation and Deployment Manual

GFI LANguard 9.0 ReportPack. Manual. By GFI Software Ltd.

Cross-domain Identity Management System for Cloud Environment

NetIQ Identity Manager Setup Guide

Wiki Server. Innovative tools for workgroup collaboration and communication. Features

BEST WEB PROGRAMMING LANGUAGES TO LEARN ON YOUR OWN TIME

Version Client Setup Guide

Web Hosting Features. Small Office Premium. Small Office. Basic Premium. Enterprise. Basic. General

October P Xerox App Studio. Information Assurance Disclosure. Version 2.0

Key Benefits of Microsoft Visual Studio Team System

J j enterpririse. Oracle Application Express 3. Develop Native Oracle database-centric web applications quickly and easily with Oracle APEX

DameWare Server. Administrator Guide

DOCUMENTATION FILE BACKUP

Oracle BI 10g: Analytics Overview

Plugin Integration Guide

Windows Client User Guide

TeamCompanion Solution Overview. Visual Studio

IT3504: Web Development Techniques (Optional)

Software Development Kit

Enterprise Vault Installing and Configuring

Software Distribution Reference

MySQL and Virtualization Guide

Web Development using PHP (WD_PHP) Duration 1.5 months

1 What Are Web Services?

QuickStart Guide for Managing Computers. Version 9.2

XTM Drupal Connector. A Translation Management Tool Plugin

Transcription:

Extracted from: Agile Web Development with Rails 4 This PDF file contains pages extracted from Agile Web Development with Rails 4, published by the Pragmatic Bookshelf. For more information or to purchase a paperback or PDF copy, please visit http://www.pragprog.com. Note: This extract contains some colored text (particularly in code listing). This is available only in online versions of the books. The printed versions are black and white. Pagination might vary between the online and printer versions; the content is otherwise identical. Copyright 2010 The Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. The Pragmatic Bookshelf Dallas, Texas Raleigh, North Carolina

Agile Web Development with Rails 4 Sam Ruby Dave Thomas David Heinemeier Hansson The Pragmatic Bookshelf Dallas, Texas Raleigh, North Carolina

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trademarks of The Pragmatic Programmers, LLC. Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein. Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http: /pragprog.com. The team that produced this book includes: Susannah Pfalzer (editor) Kim Wimpsett (copyeditor) David J Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support) Copyright 2013 Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. ISBN-13: 978-1-937785-56-7 Printed on acid-free paper. Book version: P1.0 September 2013

Contents Acknowledgments...........? Introduction............? Part I Getting Started 1. Installing Rails............? 1.1 Installing on Windows? 1.2 Installing on Mac OS X? 1.3 Installing on Linux? 1.4 Choosing a Rails Version? 1.5 Setting Up Your Development Environment? 1.6 Rails and Databases? 2. Instant Gratification..........? 2.1 Creating a New Application? 2.2 Hello, Rails!? 2.3 Linking Pages Together? 3. The Architecture of Rails Applications......? 3.1 Models, Views, and Controllers? 3.2 Rails Model Support? 3.3 Action Pack: The View and Controller? 4. Introduction to Ruby..........? 4.1 Ruby Is an Object-Oriented Language? 4.2 Data Types? 4.3 Logic? 4.4 Organizing Structures? 4.5 Marshaling Objects? 4.6 Pulling It All Together? 4.7 Ruby Idioms?

Contents v Part II Building an Application 5. The Depot Application..........? 5.1 Incremental Development? 5.2 What Depot Does? 5.3 Let s Code? 6. Task A: Creating the Application.......? 6.1 Iteration A1: Creating the Products Maintenance Application? 6.2 Iteration A2: Making Prettier Listings? 7. Task B: Validation and Unit Testing.......? 7.1 Iteration B1: Validating!? 7.2 Iteration B2: Unit Testing of Models? 8. Task C: Catalog Display..........? 8.1 Iteration C1: Creating the Catalog Listing? 8.2 Iteration C2: Adding a Page Layout? 8.3 Iteration C3: Using a Helper to Format the Price? 8.4 Iteration C4: Functional Testing of Controllers? 8.5 Iteration C5: Caching of Partial Results? 9. Task D: Cart Creation..........? 9.1 Iteration D1: Finding a Cart? 9.2 Iteration D2: Connecting Products to Carts? 9.3 Iteration D3: Adding a Button? 10. Task E: A Smarter Cart..........? 10.1 Iteration E1: Creating a Smarter Cart? 10.2 Iteration E2: Handling Errors? 10.3 Iteration E3: Finishing the Cart? 11. Task F: Add a Dash of Ajax.........? 11.1 Iteration F1: Moving the Cart? 11.2 Iteration F2: Creating an Ajax-Based Cart? 11.3 Iteration F3: Highlighting Changes? 11.4 Iteration F4: Hiding an Empty Cart? 11.5 Iteration F5: Making Images Clickable? 11.6 Testing Ajax Changes?

Contents vi 12. Task G: Check Out!...........? 12.1 Iteration G1: Capturing an Order? 12.2 Iteration G2: Atom Feeds? 13. Task H: Sending Mail..........? 13.1 Iteration H1: Sending Confirmation Emails? 13.2 Iteration H2: Integration Testing of Applications? 14. Task I: Logging In...........? 14.1 Iteration I1: Adding Users? 14.2 Iteration I2: Authenticating Users? 14.3 Iteration I3: Limiting Access? 14.4 Iteration I4: Adding a Sidebar, More Administration? 15. Task J: Internationalization.........? 15.1 Iteration J1: Selecting the Locale? 15.2 Iteration J2: Translating the Storefront? 15.3 Iteration J3: Translating Checkout? 15.4 Iteration J4: Add a Locale Switcher? 16. Task K: Deployment and Production......? 16.1 Iteration K1: Deploying with Phusion Passenger and MySQL? 16.2 Iteration K2: Deploying Remotely with Capistrano? 16.3 Iteration K3: Checking Up on a Deployed Application? 17. Depot Retrospective..........? 17.1 Rails Concepts? 17.2 Documenting What We Have Done? Part III Rails in Depth 18. Finding Your Way Around Rails........? 18.1 Where Things Go? 18.2 Naming Conventions? 19. Active Record............? 19.1 Defining Your Data? 19.2 Locating and Traversing Records? 19.3 Creating, Reading, Updating, and Deleting (CRUD)? 19.4 Participating in the Monitoring Process? 19.5 Transactions?

Contents vii 20. Action Dispatch and Action Controller......? 20.1 Dispatching Requests to Controllers? 20.2 Processing of Requests? 20.3 Objects and Operations That Span Requests? 21. Action View.............? 21.1 Using Templates? 21.2 Generating Forms? 21.3 Processing Forms? 21.4 Uploading Files to Rails Applications? 21.5 Using Helpers? 21.6 Reducing Maintenance with Layouts and Partials? 22. Migrations.............? 22.1 Creating and Running Migrations? 22.2 Anatomy of a Migration? 22.3 Managing Tables? 22.4 Advanced Migrations? 22.5 When Migrations Go Bad? 22.6 Schema Manipulation Outside Migrations? 23. Nonbrowser Applications.........? 23.1 A Stand-Alone Application Using Active Record? 23.2 A Library Function Using Active Support? 24. Rails Dependencies..........? 24.1 Generating XML with Builder? 24.2 Generating HTML with ERB? 24.3 Managing Dependencies with Bundler? 24.4 Interfacing with the Web Server with Rack? 24.5 Automating Tasks with Rake? 24.6 Survey of Rails Dependencies? 25. Rails Plugins............? 25.1 Credit Card Processing with Active Merchant? 25.2 Beautifying Our Markup with Haml? 25.3 Pagination? 25.4 Finding More at RailsPlugins.org? 26. Where to Go from Here..........? A1. Bibliography............? Index..............?