In Flex, use an HTTPService object to send a POST request to the Rails app with the text to be processed.
In your mxml:
<mx:HTTPService id="textService" url="http://myrailsapp" resultFormat="text"
result="onTextLoaded(event)" fault="onTextServiceError(event)"/>
In your as:
private function processText(textToProcess:String):void
{
textService.send( { text: textToProcess } );
}
private function onTextLoaded(event:ResultEvent):void
{
var text:String = event.result as String;
}
private function onTextServiceError(event:FaultEvent):void
{
// handle error
}
Then just create a controller in your Rails app to process and return the text. There should be many good tutorials out there on how to handle a POST in Rails.