Using ruby to submit an http form - either im confused

Hi All:

I have a rails application (we’ll call it ‘FrontApp’)that is using REST
routes. I have tested this with curl and its behaves as expected.

I also have a second independent rails application on the same server.
Also using REST routes. (we’ll call this app ‘BackApp’).

I want to beable to call and submit a form in BackApp from FrontApp and
I think im going about it the wrong way. Should I be using web service
apis on BackApp and simply invoking the service calls from FrontApp or
can i (and it is good design) to try and post the form in BackApp from
FrontApp?

Below is a snippet of a test script ive been using to attempt to post
the above mentioned form in BackApp using ruby. All i get back is the
details of the form but the event (an email sent) is not occurring as if
i were submitting the form in the BackApp application.

Net::HTTP.new(‘backapp.mydomain.com’, 80).start do |http|

test_email_req = Net::HTTP::Post.new(‘/notification/email_request’)
test_email_lic_req.set_form_data(‘email_request[email_request]’=>‘[email protected]’)
test_email_req.add_field ‘Accept’, ‘application/xml’

response = http.request(test_email_req)

case response
when Net::HTTPSuccess
puts “Code: #{response.code}”
puts “Message: #{response.message}”
puts “Body:\n #{response.body}”
else
# Throw exception
response.error!
end
end

any help would be appreciated
Thanks
Ryan