Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

rails 3.2 #1

Merged
merged 1 commit into from

1 participant

Martin Wöginger
Martin Wöginger

No description provided.

Martin Wöginger electronicbites merged commit 534b527 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 5, 2012
  1. rails 3.2 fixes

    Nico authored
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/validation_reflection.rb
8 lib/validation_reflection.rb
View
@@ -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
Something went wrong with that request. Please try again.