Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: None  |  size: 0.34 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def instantiate(attrs = nil, allocating = false)
  2.         attributes = attrs || {}
  3.         if attributes["_id"] || allocating
  4.           document = allocate
  5.           document.instance_variable_set(:@attributes, attributes)
  6.           document.setup_modifications
  7.           document
  8.         else
  9.           new(attrs)
  10.         end
  11.       end