Filesystem active record adapter

Hello,

I'm making a site where I'll host a few songs and texts I do. I decided to use RoR, instead of plain HTML, mostly because of the layouts and views. It's much nicer to write the menu HTML only once instead of repeat it across several HTML files. I don't need to tell you that, of course :).

My first idea was to just write all the views and, whenever I wanted to add a new song or text, I'd just copy it to the right directory and make a change to the view. Then I realised that I could do better. There are two other layers for me to use. I could write the view just once and it would list all the available songs and texts. All I'd need to do was to add a new song to the persistence layer; no need to change the view all the time.

Well, there's one more thought that I need to tell you before I finally ask my question. I'd really like to have the whole site (content, code, etc) in a git repository. That way I can easily work on it anywhere I go. Even better, I'd gain a backup for my site everywhere I cloned it.

Ok, now, I don't think git plays well with a sqlite database and, even more of a downer, managing (opening, editing, deleting) stuff stored on sqlite is a pain. Certainly not as easy as copying a file to a directory. So, we get to my question: is there a adapter for active record that would allow me to add content to the file system instead of a relational database?

's Rafael

Rafael C. de Almeida wrote in post #955591:

Hello,

I'm making a site where I'll host a few songs and texts I do. I decided to use RoR, instead of plain HTML, mostly because of the layouts and views. It's much nicer to write the menu HTML only once instead of repeat it across several HTML files. I don't need to tell you that, of course :).

Right. But you don't need Rails for that; in fact, I'd recommend something like StaticMatic instead.

My first idea was to just write all the views and, whenever I wanted to add a new song or text, I'd just copy it to the right directory and make a change to the view. Then I realised that I could do better. There are two other layers for me to use. I could write the view just once and it would list all the available songs and texts. All I'd need to do was to add a new song to the persistence layer; no need to change the view all the time.

Right, simple DB-driven website.

Well, there's one more thought that I need to tell you before I finally ask my question. I'd really like to have the whole site (content, code, etc) in a git repository. That way I can easily work on it anywhere I go. Even better, I'd gain a backup for my site everywhere I cloned it.

Ok, now, I don't think git plays well with a sqlite database

Git plays just fine with an SQLite database -- it's just a file. However, you don't want to use SQLite for production hosting of a Web application, thanks to its nonexistent concurrency model.

and, even more of a downer, managing (opening, editing, deleting) stuff stored on sqlite is a pain. Certainly not as easy as copying a file to a directory. So, we get to my question: is there a adapter for active record that would allow me to add content to the file system instead of a relational database?

I hope not. ActiveRecord is really designed for SQL databases.

If you want content from the filesystem, just call the filesystem -- you don't need ActiveRecord for that.

If you want to be able to edit content from anywhere, just use a CMS. Radiant is nice.

If you want version control of your content, you could use vestal_versions or some such to get that in your DB.

If you want tighter Git integration than that, you might look at ticgit and git-wiki for ideas.

If you're not using a database for this project, then I don't see any reason to use Rails as you've described it. Sinatra might be a better fit.

's Rafael

Best,