class ModelWithoutDatabase def save() raise NotImplementedError end def save!() raise NotImplementedError end def update_attribute() raise NotImplementedError end def new_record?() true end include ActiveRecord::Validations def initialize(attributes = nil) self.attributes = attributes end def attributes=(new_attributes) return unless new_attributes new_attributes.each do |k, v| k = "#{k}=" send(k, v) if respond_to?(k) end end end class Foo < ModelWithoutDatabase attr_accessor :my_attr validates_presence_of :my_attr end class FooController < ApplicationController def bar foo = Foo.new params[:foo] do_something if foo.valid? end end