require "gettext/active_record" module ActiveRecord module ValidationsWithSti # :nodoc: class << self def real_included(base) base.class_eval{ class << self def human_attribute_name_with_sti(attribute_key_name) #:nodoc: human_name = s_("#{self}|#{attribute_key_name.humanize}") if human_name == attribute_key_name.humanize && superclass.respond_to?(:human_attribute_name_with_sti) return superclass.human_attribute_name_with_sti(attribute_key_name) end human_name end alias_method_chain :human_attribute_name, :sti end } end end if respond_to? :included class << self def included_with_sti(base) # :nodoc: unless base <= ActiveRecord::Base included_without_sti(base) end real_included(base) end alias_method_chain :included, :sti end else class << self # Since rails-1.2.0. def append_features_with_sti(base) # :nodoc: unless base <= ActiveRecord::Base append_features_without_sti(base) end real_included(base) end alias_method_chain :append_features, :sti end end end class Base include ValidationsWithSti end end