Created
May 5, 2010 13:49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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