Ticket #6542: update_injection_points.diff
| File update_injection_points.diff, 1.1 kB (added by ymendel, 2 years ago) |
|---|
-
base.rb
old new 1775 1775 result != false 1776 1776 end 1777 1777 1778 def attributes_for_update 1779 attributes_with_quotes(false) 1780 end 1781 1782 def sql_for_update 1783 "UPDATE #{self.class.table_name} " + 1784 "SET #{quoted_comma_pair_list(connection, attributes_for_update)} " + 1785 "WHERE #{self.class.primary_key} = #{quote_value(id)}" 1786 end 1787 1778 1788 # Updates the associated record with values matching those of the instance attributes. 1779 1789 # Returns the number of affected rows. 1780 1790 def update 1781 connection.update( 1782 "UPDATE #{self.class.table_name} " + 1783 "SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " + 1784 "WHERE #{self.class.primary_key} = #{quote_value(id)}", 1785 "#{self.class.name} Update" 1786 ) 1791 connection.update(sql_for_update, "#{self.class.name} Update") 1787 1792 end 1788 1793 1789 1794 # Creates a record with values matching those of the instance attributes