class RackAmfController < ApplicationController def handle if request.env['rack-amf.request'] RAILS_DEFAULT_LOGGER.info "[rack-amf] Handle request" request.env['rack-amf.response'].each_method_call do |method, args| handle_call method, args end else render :text => 'Rack::AMF Gateway' end end private def handle_call method, args path = method.split('.') raise "Invalid method '#{method}': Methods must look like this 'ServiceController.method'" if path.length != 2 action = path.pop controller = path.pop end end