Skip to content

Instantly share code, notes, and snippets.

@scoop
Created December 22, 2008 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scoop/38908 to your computer and use it in GitHub Desktop.
Save scoop/38908 to your computer and use it in GitHub Desktop.
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