As much as I hate saying this, I would like to maintain 2 copies of
some data, one copy in the form of a table in a database, and one in
the form of an Excel spreadsheet. Unfortunately, either or both
copies may be modified, so I need some way to synchronize the two,
much the same way as a contacts database might be synchronized between
a PDA and a desktop application.
I am curious to learn from you... how would you do this?
I could put the "synchronize the data" logic in the ActiveRecord model
and add some controller and view code that would enable me to upload
the current spreadsheet, compute the differences between the two,
display those differences along with some mechanism to accept or
reject the changes, and download the new version of the modified
Does that "synchronize the data" logic belong in the model? In the
controller? In a helper module? I expect that it will be very
specific to the model, and to the schema of that database.
Or I could create a rake task to do this
Or I could create a standalone ruby script to do this.
Or I could do something else which I haven't even thought of yet.
I like the idea of presenting the differences via the GUI of a web
browser (even though I am daunted by the amount of work that would
entail for somebody with no web development experience).
Also, tangenting slightly, I am curious how this sort of "go off and
do some work" type of behavior would map in the the RESTful way of
doing things. I suppose that I could view the list of differences as
a resource which can be indexed and edited, but I wonder if that is
trying to fit a square peg in a round hole.
Finally, perhaps somebody has already done just this and would care to
share his/her experience in how (s)he approached this problem.
I feel reasonably confident (some would say overconfident) in my
ability to extract the data from the Excel workbook and compare it
with the data in my database. I'm just not sure where would be a
reasonable place to put that sort of logic.