lib/ripple/validations.rb in ripple-0.9.0.beta2 vs lib/ripple/validations.rb in ripple-0.9.0
- old
+ new
@@ -51,9 +51,13 @@
# Raises Ripple::DocumentInvalid if the record did not save
def create!(attrs={}, &block)
obj = create(attrs, &block)
(raise Ripple::DocumentInvalid.new(obj) if obj.new?) || obj
end
+
+ def validates_associated(*attr_names)
+ validates_with AssociatedValidator, _merge_attributes(attr_names)
+ end
end
module InstanceMethods
# @private
def save(options={:validate => true})