Skip to content

Commit

Permalink
Mongoid and Carrierwave still need a fix in validation callback. Upda…
Browse files Browse the repository at this point in the history
…ted the README accordingly.
  • Loading branch information
wearethefoos committed Oct 18, 2011
1 parent 2ba1507 commit 379824c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -71,6 +71,19 @@ def Post


after_save :save_photos 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 # Save photos callback
def save_photos def save_photos
photos.each do |photo| photos.each do |photo|
Expand Down

0 comments on commit 379824c

Please sign in to comment.