Permalink
Browse files

Mongoid and Carrierwave still need a fix in validation callback. Upda…

…ted the README accordingly.
  • Loading branch information...
1 parent 2ba1507 commit 379824c8f9d214872cbd1b56374f2eee72cbb176 @foxycoder foxycoder committed Oct 18, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 README.md
View
@@ -71,6 +71,19 @@ def Post
after_save :save_photos
+ # forward validation to embedded documents
+ def valid?(*)
+ _run_validation_callbacks { super }
+ validate_photos
+ end
+
+ # Validate photos callback
+ def validate_photos
+ photos.each do |photo|
+ photo.send(:_run_validation_callbacks)
+ end
+ end
+
# Save photos callback
def save_photos
photos.each do |photo|

0 comments on commit 379824c

Please sign in to comment.