Flexible Rails
Flex 3 on Rails 2
Peter Armstrong
  • December 2007
  • ISBN 9781933988504
  • 592 pages

... a first class learning experience that is tough to quantify but easy to qualify: Don't miss it.

Louis F. Springer, Sun Microsystems

Flexible Rails is a book about how to use Ruby on Rails and Adobe Flex to build next-generation rich Internet applications (RIAs). The book takes you to the leading edge of RIA development, presenting examples in Flex 3 and Rails 2.

This book is not an exhaustive Ruby on Rails tutorial, nor a Flex reference manual. (Adobe ships over 3000 pages of PDF reference documentation with Flex.) Instead, it's an extensive tutorial, developed iteratively, how to build an RIA using Flex and Rails together. You learn both the specific techniques you need to use Flex and Rails together as well as the development practices that make the combination especially powerful.

The example application built in the book is MIT-licensed, so readers can use it as the basis for their own applications. In fact, one reader has already built an agile project management tool based on the book example!

About the Technology

Rails is a fantastic tool for web application development, but its Ajax-driven interfaces stop short of the richness you gain with a tool like Adobe Flex. Simply put, Flex is the most productive way to build the UI of rich Internet applications, and Rails is the most productive way to rapidly build a database-backed CRUD application. Together, they're an amazing combination.

About the book

With this book, you learn Flex by osmosis. You can read the book and follow along even if you have never used Flex before. Consider it "Flex Immersion." You absorb the key concepts of Flex as you go through the process of building the application.

You will also learn how Flex and Rails integrate with HTTPService and XML, and see how RESTful Rails controller design gracefully supports using the same controller actions for Flex and HTML clients. The author will show you how Cairngorm can be used to architect larger Flex applications, including tips to use Cairngorm in a less verbose way with HTTPService to talk to Rails.

Table of Contents detailed table of contents




about this book

about the cover illustration

Part 1 Getting started

1. Why are we here? Where are we going?

1.1. Overview of the features and strengths of Flex 3 and Rails 2

1.2. Flash 9? Are you kidding me?

1.3. History

1.4. A preview of the book

1.5. Summary

2. Hello World

2.1. Installing everything

2.2. Windows or Mac OS X + Flex Builder 3

2.3. Windows + Flex SDK

2.4. Mac OS X (or Linux) + Flex SDK

2.5. Summary

3. Getting started

3.1. If you’re starting here

3.2. Freezing the Rails version

3.3. Disabling browser navigation integration

3.4. Adding login functionality to Rails

3.5. Adding login functionality to Flex

3.6. Adding data to the test fixtures

3.7. Checking the tests

3.8. Configuring Flex Builder to run and debug pomodo

3.9. Summary

Part 2 Building the application

4. Creating the main Flex UI

4.1. Requirements

4.2. Design

4.3. Code

4.4. Summary

5. Expanding the Rails code, RESTfully

5.1. A brief note about REST

5.2. Calling the user by name

5.3. Creating the new resources (including migrations, models, and controllers)

5.4. Security

5.5. Expanding our fixtures and keeping our tests passing

5.6. Summary

6. Flex on Rails

6.1. Setup

6.2. Listing tasks in Flex

6.3. Creating tasks in Flex

6.4. Creating and listing projects and locations in Flex

6.5. Making the Projects and Locations ComboBoxes work in the TaskCreateBox

6.6. About that None project and location

6.7. Updating and deleting tasks, projects, and locations

6.8. Keeping our tests passing

6.9. Summary

6.10. Exercises for the reader

7. Validation

7.1. Revisiting the HTML account signup screen

7.2. Rails and Flex validation — should you stay DRY?

7.3. Understanding Rails validation, and building custom XML for errors

7.4. A Quick look at validation in Flex 3

7.5. Integrating Rails validation with Flex 3 validation

7.6. Flex validators revisited

7.7. Keeping our tests passing

7.8. Summary

7.9. Exercises for the reader

Part 3 Refactoring

8. Refactoring to Cairngorm

8.1. Background and setup

8.2. Cairngorm event sequence overview

8.3. Creating com.pomodo.model. PomodoModelLocator

8.4. Creating com.pomodo.control.*

8.5. Adding CairngormUtils and ServiceUtils to com.pomodo.util.*

8.6. Creating com.pomodo.command.*

8.7. Creating com.pomodo.business.*

8.8. Deleting the com.pomodo.events package

8.9. Modifying the com.pomodo.components.*

8.10. Modifying Pomodo.mxml

8.11. Running pomodo

8.12. HTTPService Gotchas

8.13. Summary

8.14. Exercise for the reader

9. Holding state on the client properly

9.1. Refactoring, samurai coder style

9.2. Creating the model classes

9.3. Modifying the PomodoModelLocator

9.4. Modifying ServiceUtils

9.5. Modifying the business delegates

9.6. Modifying the commands

9.7. Modifying the components

9.8. Summary

Part 4 Finishing up

10. Finishing the application

10.1. Notely

10.2. Better security with attr_accessible

10.3. GTD semantics, including the Next Action concept and :dependent

10.4. Filtering tasks

10.5. The CommandShell

10.6. Logging out

10.7. Marketing!

10.8. Deleting users

10.9. Exercises for the reader

11. Refactoring to RubyAMF

11.1. Warning: biased author

11.2. Hello RubyAMF

11.3. Refactoring to RubyAMF, fast-forwarded

11.4. Summary

12. Rails on AIR (Adobe Integrated Runtime)

12.1. Converting pomodo to an AIR application

12.2. Refactoring event triggering

12.3. Online/Offline support

12.4. Summary

12.5. Exercises for the reader

12.6. Conclusion

Appendix A: How to use Subversion with Flex + Rails

Appendix B: Handwaving at omitted topics


What's inside

  • Flex 3 and Ruby on Rails 2 integrated with HTTPService and XML
  • RESTful Rails controllers that support Flex and HTML clients
  • Coverage of how to use Cairngorm to architect larger Flex applications
  • A full application--not just a toy--developed and refactored iteratively

About the reader

Flexible Rails is for both Rails developers who are interested in Flex, and Flex developers who are interested in Rails. For a Rails developer, Flex allows for more dynamic and engaging user interfaces than are possible with Ajax. For a Flex developer, Rails provides a way to rapidly build the ORM and services layer of the application.

About the author

Peter Armstrong has been developing rich client applications for over 7 years. He worked with Flex full-time from July 2004 (since Flex 1.0) to October 2007 for a Silicon Valley startup, and was part of the team that won the 2006 Adobe MAX Award for RIA/Web Development. Before that, he was a Java Swing developer for over 4 years for another Silicon Valley startup. On the Rails side, Peter has been tracking Ruby on Rails since mid-2005 (since before Rails 1.0) and is the organizer of The Vancouver Ruby/Rails Meetup group. Peter is also a frequent speaker on using Flex and Rails together, including presentations at The Vancouver Flash/Flex Meetup, a RailsConf 2007 BOF, The Vancouver RIA Developer Camp and Rails to Italy in Pisa. Peter lives in the Vancouver, BC area and works as a Flex/AIR/Flash developer, writer (www.flexiblerails.com) and independent consultant (www.ruboss.com).

placing your order...

Don't refresh or navigate away from the page.
eBook $24.99 $35.99 3 formats + liveBook
Flexible Rails (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks