Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rails 3.2 fixes

  • Loading branch information...
commit 60320e6beb088808fd625a8d958dbd0d2661d494 1 parent 97f2e85
Nico authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/validation_reflection.rb
View
8 lib/validation_reflection.rb
@@ -33,6 +33,8 @@ def included(base) # :nodoc:
# for later easy access.
#
def install(base)
+ base.send :class_attribute, :validations
+
@@reflected_validations.each do |validation_type|
next if base.respond_to?(:"#{validation_type}_with_reflection")
ignore_subvalidations = false
@@ -62,7 +64,7 @@ module ClassMethods
# Returns an array of MacroReflection objects for all validations in the class
def reflect_on_all_validations
- self.read_inheritable_attribute(:reflected_validations) || []
+ validations || []
end
# Returns an array of MacroReflection objects for all validations defined for the field +attr_name+.
@@ -78,9 +80,9 @@ def reflect_on_validations_for(attr_name)
#
def remember_validation_metadata(validation_type, *attr_names)
configuration = attr_names.last.is_a?(::Hash) ? attr_names.pop : {}
+ self.validations ||= []
attr_names.flatten.each do |attr_name|
- self.write_inheritable_array :reflected_validations,
- [::ActiveRecord::Reflection::MacroReflection.new(validation_type, attr_name.to_sym, configuration, self)]
+ self.validations << ::ActiveRecord::Reflection::MacroReflection.new(validation_type, attr_name.to_sym, configuration, self)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.