active_record_base_without_table plugin - Easily use models without tables

Hi all,

Here’s another little plugin I wrote to use AR models without tables. It’s dead simple, just extend from ActiveRecord::BaseWithoutTable instead of ActiveRecord::Base:

class Contact < ActiveRecord::BaseWithoutTable

column :name, :string
column :email_address, :string
column :message, :text

validates_presence_of :name, :email_address, :message

end

You can now use this model just like you would use a regular model based on a table.

Any problems, let me know.

-Jonathan.

And the install address …

http://svn.viney.net.nz/things/rails/plugins/active_record_base_without_table

-Jonathan.

Great idea but i just get "uninitialized constant BaseWithoutTable"

Use ActiveRecord::BaseWithoutTable, not just BaseWithoutTable.

A few people are using it, including myself, so it definitely works.

-Jonathan.