I found a way around this on my Flex on Rails application. I was seeing the same problem in IE - my development.log in Rails gave a 201 message, but this caused a fault coming back to Flex. I found a reference in a new book called Flex On Rails by Tony Hillerson and Daniel Wanja, on p. 31. It involves catching the 201 error and changing the header. Here's my ApplicationController file:
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
include AuthenticatedSystem
before_filter :login_required
after_filter :flex_error_handling
def flex_error_handling
response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)
response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)
end
def rescue_action_in_public(exception)
render_exception(exception)
end
def rescue_action_locally(exception)
render_exception(exception)
end
rescue_from ActiveRecord::RecordNotFound, :with => :render_exception
def render_exception(exception)
render :text => "<errors><error>#{exception}</error></errors>", :status => 200
end
end
The action of changing the 422 status message to 200 was part of Hillerman/Wanja's original suggestions to change the 2032 Stream Error into something more friendly, so that invalid record errors are sent back to the Flex UI.