lib/ripple/validations/associated_validator.rb in ripple-0.7.1 vs lib/ripple/validations/associated_validator.rb in ripple-0.8.0.beta

- old
+ new

@@ -12,17 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # # Taken from ActiveRecord::Validations::AssociatedValidators # - require 'ripple' module Ripple module Validations class AssociatedValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - unless Array(value).all? {|r| r.nil? || r.valid? } + unless Array(value).map {|r| r.nil? || r.valid? }.all? record.errors.add(attribute, :invalid, :default => options[:message], :value => value) end end end