mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fix select/reject vs lazy_loading weirdness
This commit is contained in:
parent
e53d9d34d9
commit
1052ce9c65
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue