Created
December 16, 2008 19:28
-
-
Save stevenbristol/36738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object | |
def save | |
rand > 0.5 | |
end | |
end | |
array_of_unsaved_active_record_objects = [] | |
1.upto(10) { |i| array_of_unsaved_active_record_objects << i} | |
all_saved = true | |
array_of_unsaved_active_record_objects.each do |ar| | |
x = ar.save | |
puts "#{ar} saved?: #{x}" | |
all_saved &&= x | |
end | |
puts "They all saved: #{all_saved}" | |
1 saved?: true | |
2 saved?: false | |
3 saved?: false | |
4 saved?: true | |
5 saved?: false | |
6 saved?: false | |
7 saved?: false | |
8 saved?: false | |
9 saved?: true | |
10 saved?: false | |
They all saved: false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment