Fix for clone failing when resource has numbers, booleans or nil as attribute values

Calling clone on a Fixnum, NilClass, TrueClass or FalseClass fails and throws an exception. Since this is used internally on when cloning the resource if you object contains these values it will fail. 

There might be other classes that also throw on clone(), but these seemed like the most obvious ones.
Merge remote-tracking branch 'origin/patch-1'