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