Permalink
Browse files

Merge commit 'duritong/master'

  • Loading branch information...
2 parents cbe3467 + cd8bd61 commit b6a8cfbc3853b3bdce501a1c64b34fcc0c62c2e9 @redinger committed Feb 15, 2010
Showing with 4 additions and 1 deletion.
  1. +1 −1 lib/validation_reflection.rb
  2. +3 −0 test/validation_reflection_test.rb
@@ -121,7 +121,7 @@ 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 : {}
- attr_names.each do |attr_name|
+ attr_names.flatten.each do |attr_name|
self.write_inheritable_array :validations,
[::ActiveRecord::Reflection::MacroReflection.new(validation_type, attr_name.to_sym, configuration, self)]
end
@@ -42,6 +42,8 @@ def columns
[
create_fake_column('col0'),
create_fake_column('col1'),
+ create_fake_column('col1a'),
+ create_fake_column('col1b'),
create_fake_column('col2', false, 100),
create_fake_column('col3'),
create_fake_column('col4'),
@@ -55,6 +57,7 @@ def columns
has_one :nothing
validates_presence_of :col1
+ validates_presence_of [ :col1a, :col1b ]
validates_length_of :col2, :maximum => 100
validates_format_of :col3, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
validates_numericality_of :col4, :only_integer => true

0 comments on commit b6a8cfb

Please sign in to comment.