lib/databasedotcom/sobject/sobject.rb in databasedotcom-ejholmes-1.3.3 vs lib/databasedotcom/sobject/sobject.rb in databasedotcom-ejholmes-1.3.4
- old
+ new
@@ -13,10 +13,12 @@
# Returns a new Sobject. The default values for all attributes are set based on its description.
def initialize(attrs = {})
super()
self.class.description["fields"].each do |field|
if field['type'] =~ /(picklist|multipicklist)/ && picklist_option = field['picklistValues'].find { |p| p['defaultValue'] }
- self.send("#{field["name"]}=", picklist_option['value'])
+ self.send("#{field["name"]}=", picklist_option["value"])
+ elsif field['type'] =~ /boolean/
+ self.send("#{field["name"]}=", field["defaultValue"])
else
self.send("#{field["name"]}=", field["defaultValueFormula"])
end
end
self.attributes=(attrs)