Rails Log Analyzer - Rails and Flex with JSON

I started to write a small Rails Log Analyzer that provides some insight on how a given application is used. I’ve just spent three hours so far, so not too much to show, but I have found the integration of Flex with Rails for read-only purpose of the different time series pretty straight forward.

In two words…

RAILS: data.to_json

FLEX: JSON.decode(String(srv.lastResult));

On the Rails side

The controller simply transforms the Hash return by the model into a json textual representation.

class DataController < ApplicationController

def overview
render :text => Hit.overview_data.to_json
end

end

This is an extract of the method that returns a Hash that contains the time series in an Array.