Module: ActiveRecord::Tableless

Defined in:
lib/activerecord-tableless.rb,
lib/activerecord-tableless/version.rb

Overview

ActiveRecord::Tableless

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: NoDatabase, Unsupported

Constant Summary collapse

VERSION =
"2.0.0".freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



36
37
38
# File 'lib/activerecord-tableless.rb', line 36

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