Forum: Ruby on Rails ROR with C++ Backend

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8fc88921171450c85a28873eb809bc53?d=identicon&s=25 Kevin Mehlbrech (mynock)
on 2006-03-07 04:01
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.
B34e109290c7907c5df370eab11c7a4a?d=identicon&s=25 Vikrant Rathore (Guest)
on 2006-03-07 05:03
(Received via mailing list)
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
This topic is locked and can not be replied to.