0
@@ -479,7 +479,7 @@ module ActiveRecord #:nodoc:
0
# Deletes the record with the given +id+ without instantiating an object first. If an array of ids is provided, all of them
0
- delete_all([ "#{
primary_key} IN (?)", id ])
0
+ delete_all([ "#{
connection.quote_column_name(primary_key)} IN (?)", id ])
0
# Destroys the record with the given +id+ by instantiating the object and calling #destroy (all the callbacks are the triggered).
0
@@ -526,12 +526,12 @@ module ActiveRecord #:nodoc:
0
# for looping over a collection where each element require a number of aggregate values. Like the DiscussionBoard
0
# that needs to list both the number of posts and comments.
0
def increment_counter(counter_name, id)
0
- update_all "#{co
unter_name} = #{counter_name} + 1", "#{primary_key} = #{quote_value(id)}"
0
+ update_all "#{co
nnection.quote_column_name(counter_name)} = #{connection.quote_column_name(counter_name)} + 1", "#{connection.quote_column_name(primary_key)} = #{quote_value(id)}"
0
# Works like increment_counter, but decrements instead.
0
def decrement_counter(counter_name, id)
0
- update_all "#{co
unter_name} = #{counter_name} - 1", "#{primary_key} = #{quote_value(id)}"
0
+ update_all "#{co
nnection.quote_column_name(counter_name)} = #{connection.quote_column_name(counter_name)} - 1", "#{connection.quote_column_name(primary_key)} = #{quote_value(id)}"
0
@@ -1020,7 +1020,7 @@ module ActiveRecord #:nodoc:
0
def find_one(id, options)
0
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
0
- options.update :conditions => "#{table_name}.#{
primary_key} = #{quote_value(id,columns_hash[primary_key])}#{conditions}"
0
+ options.update :conditions => "#{table_name}.#{
connection.quote_column_name(primary_key)} = #{quote_value(id,columns_hash[primary_key])}#{conditions}"
0
# Use find_every(options).first since the primary key condition
0
# already ensures we have a single record. Using find_initial adds
0
@@ -1035,7 +1035,7 @@ module ActiveRecord #:nodoc:
0
def find_some(ids, options)
0
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
0
ids_list = ids.map { |id| quote_value(id,columns_hash[primary_key]) }.join(',')
0
- options.update :conditions => "#{table_name}.#{
primary_key} IN (#{ids_list})#{conditions}"
0
+ options.update :conditions => "#{table_name}.#{
connection.quote_column_name(primary_key)} IN (#{ids_list})#{conditions}"
0
result = find_every(options)
0
@@ -1558,7 +1558,7 @@ module ActiveRecord #:nodoc:
0
connection.delete <<-end_sql, "#{self.class.name} Destroy"
0
DELETE FROM #{self.class.table_name}
0
- WHERE #{
self.class.primary_key} = #{quoted_id}
0
+ WHERE #{
connection.quote_column_name(self.class.primary_key)} = #{quoted_id}
0
@@ -1797,7 +1797,7 @@ module ActiveRecord #:nodoc:
0
"UPDATE #{self.class.table_name} " +
0
"SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " +
0
- "WHERE #{
self.class.primary_key} = #{quote_value(id)}",
0
+ "WHERE #{
connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}",
0
"#{self.class.name} Update"
Comments
No one has commented yet.