ActiveRecord::Tableless 0.1

ActiveRecord::Tableless has just been released to

First made popular on the (now extinct) fourms, the tableless model has been very popular. Why a tableless model? Read on…


ActiveRecord::Tableless allows you to create a ActiveRecord model that is not associated with a table in your database. This is a great way to exploit ActiveRecord’s validation features for simple tasks like validating the content of a contact form before sending an email.

Another great use for tableless models is mocking. I use ActiveRecord::Tableless extensively in the specs I write for some of my own ActiveRecord mixin’s without worrying about the tables or test databases being setup.

It works great for non-Rails applications too, just in case


The original forum post detailing the code is no longer available, not even in Google’s cache search. So unfortunately I cannot credit the original authors fully. The code does however appear on several other sites and is roughly the same than the code provided here.

Welcome to the Open Sourcery Archives. These are my older blog posts, from days gone by. I'm keeping them up as part of the historical record. That, and I'm strangely sentimental about them. Please keep in mind that things most certainly have changed since these articles were written, links to external sites might be broken, and general thinking might have changed.

Regardless of all this, I hope you enjoy your stay!

comments powered by Disqus