Chapter 6. Flex on Rails

 

Web 2.0, proper noun

The name given to the social and technical sophistication and maturity that mark the—Oh, screw it. Money! Money money money! Money! The money’s back! Ha ha! Money!

Greg Knauss, “The Devil’s Dictionary” (2.0),[1]http://www.eod.com/devil/archive/web_20.html

1This is a reference to The Devil’s Dictionary by Ambrose Bierce, which is great reading too.

In this fairly substantial iteration, we’ll finally hook up most of the main Flex UI to the Rails controllers, including the new TasksController, ProjectsController, and LocationsController. Given the work we’ve done on the account creation and login panels, you may think it’s just going to be a matter of defining a bunch of HTTPServices and hooking them up. If so, you’re essentially right. But the details matter, of course.

Let’s dive in.

6.1. Setup

If you didn’t run newdb.bat at the end of the last iteration, run it now. Doing so ensures that the tasks, projects, and locations we defined in the fixtures at the end of the previous iteration are loaded:

c:\peter\flexiblerails\current\pomodo>newdb.bat
...

Next, we start our server with ruby script\server, go to http://localhost:3000, and log in as ludwig (his password is foooo, as specified in users.yml). We see the screen shown in figure 6.1.

Figure 6.1. Ludwig’s tasks, created in fixtures (HTML)

6.2. Listing tasks in Flex

If we then go to http://localhost:3000/bin/Pomodo.html and log in as ludwig, the tasks list looks like figure 6.2.

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