diff --git a/lib/fog/collection.rb b/lib/fog/collection.rb index 6e35ea7a4..7263b58bb 100644 --- a/lib/fog/collection.rb +++ b/lib/fog/collection.rb @@ -10,11 +10,11 @@ module Fog RUBY end - %w[collect map reject select].each do |method| + %w[reject select].each do |method| class_eval <<-RUBY def #{method}(*args) lazy_load - self.class.new({}).concat(super) + self.class.new(:connection => self.connection).load(super) end RUBY end @@ -101,6 +101,11 @@ module Fog data end + def load(array) + @loaded = true + self.clear.concat(array) + end + def model self.class.instance_variable_get('@model') end