Module: ActiveRecord::Tablefree

Defined in:
lib/activerecord/tablefree.rb,
lib/activerecord/tablefree/version.rb,
lib/activerecord/tablefree/cast_type.rb,
lib/activerecord/tablefree/connection.rb,
lib/activerecord/tablefree/transaction.rb,
lib/activerecord/tablefree/schema_cache.rb,
lib/activerecord/tablefree/statement_cache.rb

Overview

ActiveRecord::Tablefree

Allow classes to behave like ActiveRecord models, but without an associated database table. A great way to capitalize on validations. Based on the original post at www.railsweenie.com/forums/2/topics/724 (which seems to have disappeared from the face of the earth).

Example usage

class ContactMessage < ActiveRecord::Base

  has_no_table

  column :name,    :string
  column :email,   :string
  column :message, :string

end

msg = ContactMessage.new( params[:msg] )
if msg.valid?
  ContactMessageSender.deliver_message( msg )
  redirect_to :action => :sent
end

Defined Under Namespace

Modules: ActsMethods, ClassMethods, InstanceMethods, SingletonMethods Classes: CastType, Connection, InvalidColumnType, NoDatabase, SchemaCache, StatementCache, Transaction, Unsupported

Constant Summary collapse

VERSION =
'3.1.7'.freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



41
42
43
# File 'lib/activerecord/tablefree.rb', line 41

def self.included(base) #:nodoc:
  base.send :extend, ActsMethods
end