Module: ActiveRecord::Tableless
- Defined in:
- lib/activerecord-tableless.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.( msg )
redirect_to :action => :sent
end
Defined Under Namespace
Modules: ActsMethods, ClassMethods, InstanceMethods, SingletonMethods Classes: NoDatabase, Unsupported
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Class Method Details
.included(base) ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/activerecord-tableless.rb', line 35 def self.included( base ) #:nodoc: base.send :extend, ActsMethods end |