Chapter 11. Refactoring to RubyAMF
111000011100011110000011110101000111
RubyAMF
RubyAMF is an Open Source, MIT-licensed (with one exception, as explained in a moment) Flash Remoting gateway for Ruby on Rails. It focuses on speed, and it integrates directly with RESTful Rails controllers via render :amf. Because of this, RubyAMF can be used as a more efficient wire format for sending information between Flex and Rails. (Of course, any time you see a claim that something is more efficient, you should do your own benchmarks or profiling. As such, I’m not going to do it for you here.)
RubyAMF also features a standalone implementation that doesn’t depend on Rails—it’s called RubyAMF and not RailsAMF. But because this book is about Rails in particular and not just Ruby—it’s called Flexible Rails, not Flexible Ruby—the standalone RubyAMF is beyond the scope of the iteration.
In this iteration, we’ll start by installing RubyAMF and doing a quick “Hello World” test. We’ll then refactor the tasks, projects, locations, and note to be sent between Flex and Rails via RemoteObject to RubyAMF instead of using HTTPService and XML. (We won’t touch the login code: There’s no reason to do so, and I want to keep this iteration as small as possible.)