We recently switched to rails 2.3.4 and noticed the following error:
undefined method self_and_descendants_from_active_record for Cart:Class
Our Cart class has no ActiveRecord binding, but we need some validations, so we simple use
@errors = ActiveRecord::Errors.new(self)
and overerride the valid? action.
But now we get the undefined method error.
Solution
Implement in your class also:
def self.self_and_descendants_from_active_record
[self]
end
def self.human_name(options = {})
defaults = self_and_descendants_from_active_record.map do |klass|
:"#{klass.name.underscore}"
end
defaults < [:activerecord, :models], :count => 1, :default => defaults}.merge(options))
end
def self.human_attribute_name(attribute_key_name, options = {})
defaults = self_and_descendants_from_active_record.map do |klass|
:"#{klass.name.underscore}.#{attribute_key_name}"
end
defaults << options[:default] if options[:default]
defaults.flatten!
defaults < defaults, :scope => [:activerecord, :attributes]))
end
and you can still use ActiveModel like validations


