lib/databasedotcom/sobject/sobject.rb in databasedotcom-1.1.2 vs lib/databasedotcom/sobject/sobject.rb in databasedotcom-1.1.4

- old
+ new

@@ -96,17 +96,18 @@ if self.client.delete(self.class, self.Id) self end end - # Reloads the record from the Force.com database. Returns the reloaded record. + # Reloads the record from the Force.com database. Returns self. # # client.materialize("Car") # c = Car.find_by_Color("Yellow") # c.reload def reload - self.class.find(self.Id) + self.attributes = self.class.find(self.Id).attributes + self end def [](attr_name) self.send(attr_name) rescue nil end @@ -301,10 +302,10 @@ def self.soql_conditions_for(params) params.inject([]) do |arr, av| case av[1] when String - value_str = "'#{av[1]}'" + value_str = "'#{av[1].gsub("'", "\\\\'")}'" when DateTime, Time value_str = av[1].strftime("%Y-%m-%dT%H:%M:%S.%L%z").insert(-3, ":") else value_str = av[1].to_s end \ No newline at end of file