lib/medea/jasondeferredquery.rb in medea-0.2.13 vs lib/medea/jasondeferredquery.rb in medea-0.2.14
- old
+ new
@@ -98,11 +98,11 @@
execute_query unless self.state == :postfetch
self.contents.count
end
#end array interface
- def execute_query
+ def execute_query content=false
#hit the URL
#fill self.contents with :ghost versions of JasonObjects
begin
#puts " = Executing #{type.name} deferred query! (#{to_url})"
result = JSON.parse(RestClient.get to_url)
@@ -112,10 +112,10 @@
if k =~ /^[0-9]+$/
#this is a result! get the key
/\/([^\/]*)\/([^\/]*)$/.match result[k]["POST_TO"]
#$1 is the class name, $2 is the key
item = type.new($2, :lazy)
- if result[k].has_key? "CONTENT"
+ if result[k].has_key? "CONTENT" && content
item.instance_variable_set(:@__jason_data, result[k]["CONTENT"])
item.instance_variable_set(:@__jason_state, :stale)
end
self.contents << item
end