lib/databasedotcom/sobject/sobject.rb in databasedotcom-1.2.3 vs lib/databasedotcom/sobject/sobject.rb in databasedotcom-1.2.4
- old
+ new
@@ -17,9 +17,17 @@
self.send("#{field["name"]}=", field["defaultValueFormula"])
end
self.attributes=(attrs)
end
+ # Returns a hash representing the state of this object
+ def attributes
+ self.class.attributes.inject({}) do |hash, attr|
+ hash[attr] = self.send(attr.to_sym)
+ hash
+ end
+ end
+
# Set attributes of this object, from a hash, in bulk
def attributes=(attrs)
attrs.each do |key, value|
self.send("#{key}=", value)
end