I'm not sure I understand exactly, but let me try and get this straight. Every time you create a particular model, you'd like to send an XML message off to Amazon SQS? If that's the case, then...
keep your controller as so:
def create
@thing = Thing.new(params[:thing])
if @thing.save
#render view/partial/other
else
#display errors to user
end
Then, you'll use an Observer to make the call to Amazon. Put your observer right inside your models directory:
/app/models/Thing.rb
/app/models/ThingObserver.rb
Your observer might look something like:
class ThingObserver < ActiveRecord::Observer
def after_create(thing)
AmazonSQSPlugin.send(thing.to_xml)
end
end
The code in the observer will be run after every create. If the after_create in the observer returns false, the entire create is rolled back, as if it never happened.
You might have to edit your environment config to get the observer to fire though, depending on how your application is currently set up.