Hi All,
I'm about to jump into Ruby on Rails for a new project, but wanted to see if anyone has some tips for my specific situation:
Basically I already have a web service in PHP that communicates with a non-web based application to sync data between instances, storing the data in MySQL. This is all working great, and there is no need to change it.
I now wish to add a web based front end to this system, and am looking at RoR to do it.
So there's not much legacy code (since there is no web site right now), but there is a legacy database, and a few methods that I may need to expose to Ruby from PHP.
Regarding the legacy database: - Any pointers on reconfiguring an existing database to use rails? Do I *have* to rename all the primary keys to 'id' ? - Should I re-create the structure in migrations, or just manage things the old way (i.e. big list of sql update statements)
The web site will be basic CRUD, but with one exception:
I can't just use the standard "Update" functions of RoR (i.e. the ones that map to an UPDATE SQL statement). The design is this: I never update any rows on this database, rather I insert the record again, and mark the old one as "old". This is done to give users an unlimited undo function (think a little like how Wordpress does it)
- Do you have any suggestions to get me started on overriding the model's standard update function to instead do this special handling?
- I may also need to override the "Read" function to use not the primary key, but different unique key I give the record, one that doesn't change between revisions (and also to only return the newest version). Will this be difficult?
Finally, what is the simplest way to interface with an internal PHP service? Do a JSON formatted http://localhost request and just get back the array of data?
Thanks in advance for your help.
Regards, Will