POST or ActiveRecord save?


#1

Hi, I have an application in which I’m generating data on my PC at work
and then sending it to a shared hosting site where a Rails application
shares it out to the world.

I have 2 options for forwarding the data from my PC to the Rails
application on the server:

  1. Have a controller action in the Rails app that accepts the data
    through a POST operations
    e.g. POST data to something like -
    http://example.org/data/receive_from_client

  2. Since the data on my PC is generated by a Ruby script, it’s equally
    easy for me to use the development version of the same Rails app and use
    ActiveRecord with the database.yml properties set for the database used
    by the Rails app and save it to the database direct without going
    through the Rails application.

Is there any benefit in using one over the other? For example, does #2
leave my Rails application appearing more responsive since it doesn’t
use the application thread? Or am I just thinking too much?

Cheers,
Mohit.
7/25/2007 | 3:46 PM.


#2

I’d say either way is fine, but IMO method #1 gives you the advantage
of being able to update the production server from anywhere, not just
your work PC.