mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
load items on map/each if they are not already loaded.
This gets rid of ugly things like collection.each { |item| item.reload; ... do something .. }
This commit is contained in:
parent
b31f8b7201
commit
60cff85fb4
1 changed files with 8 additions and 1 deletions
|
@ -65,7 +65,14 @@ module Fog
|
|||
|
||||
def each
|
||||
super do |item|
|
||||
item.reload
|
||||
item.reload unless item.loaded?
|
||||
yield(item)
|
||||
end
|
||||
end
|
||||
|
||||
def map
|
||||
super do |item|
|
||||
item.reload unless item.loaded?
|
||||
yield(item)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue