ActiveRecord::Base Without Table

Get the power of ActiveRecord models, including validation, without having a table in the database.

1 class Contact < ActiveRecord::BaseWithoutTable
2     column :name, :string
3     column :email_address, :string
4     column :message, :text
5     
6     validates_presence_of :name, :email_address, :string
7   end

This model can be used just like a regular model based on a table, except it will never be saved to the database.

Tags

You need to Login to tag this item.