Building a Flex/Rails App - Part I 1

Posted by daniel

I want to build a webapp to track my run progress for my marathon training.  So, being a geek, I thought what better way to track my time than to build a webapp.  Because I've started working with Flex at work, I decided that I wanted to build a Flex UI running on top of a REST based Rails webapp because I want to gain some experience with both of those technologies.  I'm going to give a little back by documenting the process.   I don't know if this will help anyone else, but I certainly hope so.

I'm also going to be pulling data off of a ipod nano with the nike+ipod kit and possibly my Garmin Forerunner 305 for my actual miles.

Architecture

These are the architectural requirements for the project.  Pretty simple really.

Requirements
  • Ruby on Rails 1.2

Table model
  • user - simple user table that has login/pwd for user sessions
  • runs - table that has individual run data - time, distance, pace, expected distance
  • device - optional information for device that supplied run data (like ipod)
  • session - it's better to use an active_record_session store than a file store in my opinion because it's much easier to support.

Rails plugins

Why REST and not WebORB?

So if you are like me and new to these technologies, you want to know what exactly is WebOrb... does it have anything to do with spiders? (no) From the WebOrb for Rails site:

“WebORB for Rails is server-side technology enabling connectivity between Flex and Flash Remoting clients and Ruby on Rails applications. WebORB for Rails can be installed as a plugin into any Rails application to expose Ruby classes as remote services. The product provides a complete implementation of the Adobe’s AMF0 and AMF3 messaging protocols and thus supports any Flash Remoting or Flex client.

Flex Builder projects can be configured to use Flex Data Services and point to a WebORB for Rails installation, however, the current release supports only the RPC featureset of the Flex Data Services technology. “

Another explanation for weborb from this Google Groups discussion states:

What WebORB allows you to do is to transfer Rails objects directly from
the server to the client, using a protocol called AMF, which is a binary
protocol (unlike REST, which is XML / text based...)

So, after a little research, I'm sticking with REST.  I don't have any need for passing large, complex objects like byte arrays or for using [RemoteObject] to send typed classes to Flex (although I am doing that at work.)

Flex UI

I'll save this information for Part II to be continued...