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
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
%w[collect map reject select].each do |method|
|
%w[reject select].each do |method|
|
||||||
class_eval <<-RUBY
|
class_eval <<-RUBY
|
||||||
def #{method}(*args)
|
def #{method}(*args)
|
||||||
lazy_load
|
lazy_load
|
||||||
self.class.new({}).concat(super)
|
self.class.new(:connection => self.connection).load(super)
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
@ -101,6 +101,11 @@ module Fog
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load(array)
|
||||||
|
@loaded = true
|
||||||
|
self.clear.concat(array)
|
||||||
|
end
|
||||||
|
|
||||||
def model
|
def model
|
||||||
self.class.instance_variable_get('@model')
|
self.class.instance_variable_get('@model')
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue