Skip to content

Instantly share code, notes, and snippets.

@reagent
Created May 5, 2010 13:49
module Validatable
def save
false
end
def save!
false
end
def new_record?
true
end
def id
object_id
end
module ClassMethods
def human_name
self.to_s.underscore.humanize
end
def human_attribute_name(attribute_key_name)
attribute_key_name.to_s.humanize
end
def self_and_descendants_from_active_record
[self]
end
end
def self.included(base)
base.extend ClassMethods
base.send(:include, ActiveRecord::Validations)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment