lib/bumeran.rb in bumeran-0.2.2 vs lib/bumeran.rb in bumeran-0.2.3
- old
+ new
@@ -204,20 +204,20 @@
object = send(objects_sym).select{|id, content| id == object_id} # pais = paises.select{|id, pais| id == pais_id}
object ? object[object_id] : nil # pais ? pais[pais_id] : nil
end #end
def self.generic_find_all_in(objects_sym, parent_object_sym, parent_service_sym, parent_object_id)
- if class_variable_get("@@#{objects_sym}").empty? # if @@zonas.empty?
+ if !class_variable_get("@@#{objects_sym}").empty? && send(parent_object_sym, parent_object_id)[objects_sym.to_s] # if !@@zonas.empty? && pais(pais_id)["zonas"]
+ send(parent_object_sym, parent_object_id)[objects_sym.to_s] # pais(pais_id)["zonas"] # pais(pais_id)["zonas"]
+ else # else
parent_object = send(parent_service_sym)[parent_object_id] # pais = paises[pais_id]
if parent_object[objects_sym.to_s] # if pais["zonas"]
parent_object[objects_sym.to_s].merge!(send("get_#{objects_sym}_in", parent_object_id)) # pais["zonas"].merge!(get_zonas_in(pais_id))
else # else
parent_object[objects_sym.to_s] = send("get_#{objects_sym}_in", parent_object_id) # pais["zonas"] = get_zonas_in(pais_id)
end # end
- else # else
- send(parent_object_sym, parent_object_id)[objects_sym.to_s] # pais(pais_id)["zonas"] # pais(pais_id)["zonas"]
end # end
end
# Generation of dynamic static methods
SERVICES.each do |service_name, service|
@@ -241,10 +241,10 @@
end
def self.subareas
if @@subareas.empty?
areas.each do |area_id, area|
- area["subareas"] ? area["subarea"].merge!(get_subareas_in(area_id)) : area["subarea"] = get_subareas_in(area_id)
+ area["subareas"] ? area["subareas"].merge!(get_subareas_in(area_id)) : area["subareas"] = get_subareas_in(area_id)
end
end
@@subareas
end