views:

299

answers:

3

Is it possible to use single XML file for Ruby on Rails as an ActiveRecord database?

+3  A: 

No, AFAIK,

I would suggest you to use sqlite3 as database, since it's lightweight and small. If you want to generate XML from that, you can just use to_xml method :)

Sikachu
Yes, I think that't the way I'll use, because there are no working XML adapters for ActiveRecord over the net :(
totocaster
+1  A: 

Read this stackoverflow posting for a rundown on this topic. The answer boils down to scalability and data integrity. At some point the data file will get big enough that it will need on-disk indexes, which are not directly supported in XML. Also, an XML file is not transactional - it has no logs. To implement a transactional storage in an XML file you would have to implement a DBMS, and create supplemental transactional log and index files. This is almost certainly far more trouble than it's worth.

ConcernedOfTunbridgeWells
+1  A: 

I'd say it was possible, but you really wouldn't want to do it!

It would involve writing a new XML ActiveRecord adapter that would issue XPath (presumably) queries against your file where the other adapters would generate SQL. I suppose you'd also need migrations to maintain XSD or DTD files.

It's horrible. Don't do it.

Mike Woodhouse