Fix deprecated ActiveModel::Errors#add options

This commit is contained in:
Greg Sterndale 2010-12-28 15:22:29 -05:00
parent 83b70ec080
commit 8d9637249c
2 changed files with 6 additions and 1 deletions

View file

@ -6,7 +6,7 @@ module CouchRest
def validate_each(document, attribute, value)
values = value.is_a?(Array) ? value : [value]
return if values.collect {|doc| doc.nil? || doc.valid? }.all?
document.errors.add(attribute, :invalid, :default => options[:message], :value => value)
document.errors.add(attribute, :invalid, :message => options[:message], :value => value)
end
end
end

View file

@ -284,6 +284,11 @@ describe CouchRest::Model::CastedModel do
@toy2.errors.should be_empty
@toy3.errors.should_not be_empty
end
it "should not use dperecated ActiveModel options" do
ActiveSupport::Deprecation.should_not_receive(:warn)
@cat.should_not be_valid
end
end
describe "on a casted model property" do