Created
December 22, 2008 06:38
-
-
Save scoop/38908 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/cash/query/abstract.rb b/lib/cash/query/abstract.rb | |
index 2452200..48a3476 100644 | |
--- a/lib/cash/query/abstract.rb | |
+++ b/lib/cash/query/abstract.rb | |
@@ -1,7 +1,7 @@ | |
module Cash | |
module Query | |
class Abstract | |
- delegate :with_exclusive_scope, :get, :table_name, :indices, :find_from_ids_without_cache, :cache_key, :to => :@active_record | |
+ delegate :with_exclusive_scope, :get, :table_name, :indices, :find_from_ids_without_cache, :cache_key, :columns_hash, :to => :@active_record | |
def self.perform(*args) | |
new(*args).perform | |
@@ -102,7 +102,7 @@ module Cash | |
conditions.split(AND).inject([]) do |indices, condition| | |
matched, table_name, column_name, sql_value = *(KEY_EQ_VALUE.match(condition)) | |
if matched | |
- value = sql_value == '?' ? values.shift : sql_value | |
+ value = sql_value == '?' ? values.shift : columns_hash[column_name].type_cast(sql_value) | |
indices << [column_name, value] | |
else | |
return nil | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment