Models not tied to DB

Tha my not be entirely true. It depends on what you want out of it. It’s very difficult for example to use validation if you don’t use AR.

There are a couple of plugins you may find useful

http://www.agilewebdevelopment.com/plugins/active_form

http://www.agilewebdevelopment.com/plugins/activerecord_base_without_table

Hope that helps

No… super super easy to do validations, etc without a db.

http://www.bphogan.com/learn/pdf/tableless_contact_form.pdf

As always, thanks to Rick Olson for the original idea.

Yes this is nice… I had seen this a loooong time ago but I had no idea where I saw it. Thanx for the link

This is what the active_record_base_without_table plugin does. I have pasted the entire working code of the plugin here. The save method has not been implemented in this one.

module ActiveRecord
  class BaseWithoutTable < Base
    self.abstract_class = true

    def create_or_update
      errors.empty?
    end

    class << self
      def columns()

        @columns ||= []
      end

      def column(name, sql_type = nil, default = nil, null = true)
        columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)

      end
    end
  end
end