<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,8 @@
-ActiveRecord::Schema.define(:version =&gt; 1) do
+ActiveRecord::Schema.define(:version =&gt; 2) do
   create_table &quot;stories&quot;, :force =&gt; true do |t|
     t.string &quot;title&quot;, &quot;subtitle&quot;
     t.string  &quot;type&quot;
+    t.boolean &quot;published&quot;
   end
 
   create_table &quot;characters&quot;, :force =&gt; true do |t|</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -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 =&gt; :@active_record
+      delegate :with_exclusive_scope, :get, :table_name, :indices, :find_from_ids_without_cache, :cache_key, :columns_hash, :to =&gt; :@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 &lt;&lt; [column_name, value]
           else
             return nil</diff>
      <filename>lib/cash/query/abstract.rb</filename>
    </modified>
    <modified>
      <diff>@@ -123,6 +123,15 @@ module Cash
             Story.find(:first, :conditions =&gt; []).should == story
           end
         end
+        
+        describe &quot;#find(:first, :conditions =&gt; '...')&quot; do
+          it &quot;uses the active record instance to typecast values extracted from the conditions&quot; do
+            story1 = Story.create! :title =&gt; 'a story', :published =&gt; true
+            story2 = Story.create! :title =&gt; 'another story', :published =&gt; false
+            Story.get('published/false').should == [story2.id]
+            Story.find(:first, :conditions =&gt; 'published = 0').should == story2
+          end
+        end
       end
 
       describe '#find_by_attr' do</diff>
      <filename>spec/cash/active_record_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,6 +37,7 @@ Spec::Runner.configure do |config|
     Story.class_eval do
       index :title
       index [:id, :title]
+      index :published
     end
 
     Epic = Class.new(Story)</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>02aecfedab6492f7eed265ed29ad2f0414e71413</id>
    </parent>
  </parents>
  <author>
    <name>Patrick Lenz</name>
    <email>patrick+macprotm@limited-overload.de</email>
  </author>
  <url>http://github.com/nkallen/cache-money/commit/fc4fb74a50eab3f1682b54b0ab07d314db9fd4d6</url>
  <id>fc4fb74a50eab3f1682b54b0ab07d314db9fd4d6</id>
  <committed-date>2009-01-07T17:36:52-08:00</committed-date>
  <authored-date>2008-12-22T18:14:21-08:00</authored-date>
  <message>Use the ActiveRecord object to typecast values extracted from a condition. Solves problems with differing cache keys (published/0 vs. published/false)

Signed-off-by: Nick Kallen &lt;nick@pivotallabs.com&gt;</message>
  <tree>cfb7af604749420c3f8044502bbc0e2621f8f930</tree>
  <committer>
    <name>Nick Kallen</name>
    <email>nick@pivotallabs.com</email>
  </committer>
</commit>
