lib/collector/repository.rb in collector-0.0.5 vs lib/collector/repository.rb in collector-0.0.6

- old
+ new

@@ -19,9 +19,23 @@ def model name.to_s.gsub("Repository", "").constantize end + def save(model) + model.touch + save_without_updating_timestamps(model) + end + + def save_without_updating_timestamps(model) + attributes = serialize(model) + collection.insert(attributes) + end + + def serialize(model) + model.attributes.reject { |key, val| val.nil? } + end + end end end