Permalink
Browse files

Merge pull request #30 from balmbees/master

fix value quoting
  • Loading branch information...
2 parents 71f356a + fbf8d97 commit 4e7d3eb8cc49468e7c10f031957cfcacdbd7e78e @sdsykes committed Jul 13, 2015
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/slim_scrooge/callsite.rb
View
4 lib/slim_scrooge/callsite.rb
@@ -56,7 +56,7 @@ def initialize(model_class)
def essential_columns(model_class)
model_class.reflect_on_all_associations.inject([@primary_key]) do |arr, assoc|
if assoc.options[:dependent] && assoc.macro == :belongs_to
- arr << assoc.respond_to?(:foreign_key) ? assoc.foreign_key : assoc.primary_key_name
+ arr << (assoc.respond_to?(:foreign_key) ? assoc.foreign_key : assoc.primary_key_name)
end
arr
end
@@ -90,7 +90,7 @@ def missing_columns(fetched_columns)
# in the result set, specified by primary_keys
#
def reload_sql(primary_keys, fetched_columns)
- sql_keys = primary_keys.collect{|pk| "#{connection.quote_column_name(pk)}"}.join(ScroogeComma)
+ sql_keys = primary_keys.collect{|pk| "#{connection.quote(pk, @columns_hash[@primary_key])}"}.join(ScroogeComma)
cols = scrooge_select_sql(missing_columns(fetched_columns))
"SELECT #{cols} FROM #{@quoted_table_name} WHERE #{@quoted_primary_key} IN (#{sql_keys})"
end

0 comments on commit 4e7d3eb

Please sign in to comment.