lib/spiderfw/model/model.rb in spiderfw-0.6.20 vs lib/spiderfw/model/model.rb in spiderfw-0.6.21
- old
+ new
@@ -228,10 +228,11 @@
require 'yaml'
data = YAML.load_file(file)
end
# Ruby 1.9: steps are not needed with ordered hashes
data = [data] unless data.is_a?(Array)
+ loaded = []
data.each do |step|
step.each do |mod_name, mod_data|
mod = const_get_full(mod_name)
mod.mapper.truncate! if truncate
mod_data.each do |row|
@@ -246,12 +247,14 @@
end
h[k] = v
end
obj = mod.new(h)
obj.insert
+ loaded << obj
end
end
end
+ loaded
end
# Generic Model error.
class ModelException < RuntimeError
\ No newline at end of file