Module: Pottery::ClassMethods
- Defined in:
- lib/pottery.rb
Instance Method Summary collapse
Instance Method Details
#restore(name) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pottery.rb', line 20 def restore name snip = Soup[name] if snip && snip != [] instance = self.new attributes = snip.attributes unless attributes.empty? id_name = attributes.delete('name') name = attributes.delete('name_name') attributes['id_name'] = id_name if id_name attributes['name'] = name if name instance.morph attributes end instance else nil end end |