Is there a fairly simple way to use Ruby on Rails with a C++ backend where both the C++ code and the Rails code will have access to a database through the same place? I'm trying to write a web interface that uses an existing C++ program to do most of the data manipulation and calculations, but both the UI and the backend need to be able to CRUD the database. Is there a way to do this so that both modules access the database using the same code? I'm trying to avoid duplicating data validation as much as possible. One option is to pass everything through the C++ code and let it handle the database interractions and then pass the information back to Rails. If I were to do it this way, I would be avoiding one of Rails most useful features. Also, passing the information this way is not very fun to implement. I was thinking there might be a way to wrap the ActiveRecord code in C++ somehow so that the backend would just use the same simple database interface that rails uses. I'm not sure if this is possible or how to do it. Please respond with suggestions on how do do this or any other way to implement this system. Thanks.
on 2006-03-07 04:01
on 2006-03-07 05:03
hi Kevin, You can use Swig interface and then write ruby wrapper classes, it would make the job much easier and use pure ruby code. If you want to use ActiveRecord it should also not be difficult you just need to write a different driver which uses your api in C++ instead of db api calls. thanks Vikrant