ernie/squeel — Issue #109: Cannot visit FalseClass - using when two times in a row
Author: gorn
Created: 2012-03-06 14:50:51+00:00
State: open

Hi,

I am obserwing strange behaviour with squeel. I have been able to narrow it down with this line failing:

```ruby
Split.joins{transfer}.where{transfer.amount == 'xy'}.where{transfer.popis == 'xy'}.to_sql
```

with this trace

```
squeel (0.9.3) lib/squeel/visitors/visitor.rb:104:in `visit'
squeel (0.9.3) lib/squeel/visitors/predicate_visitor.rb:64:in `visit_Squeel_Nodes_KeyPath'
squeel (0.9.3) lib/squeel/visitors/visitor.rb:97:in `send'
squeel (0.9.3) lib/squeel/visitors/visitor.rb:97:in `visit'
squeel (0.9.3) lib/squeel/visitors/predicate_visitor.rb:43:in `visit_Array'
squeel (0.9.3) lib/squeel/visitors/predicate_visitor.rb:43:in `map'
squeel (0.9.3) lib/squeel/visitors/predicate_visitor.rb:43:in `visit_Array'
squeel (0.9.3) lib/squeel/visitors/visitor.rb:97:in `send'
squeel (0.9.3) lib/squeel/visitors/visitor.rb:97:in `visit'
squeel (0.9.3) lib/squeel/visitors/visitor.rb:26:in `accept'
squeel (0.9.3) lib/squeel/adapters/active_record/relation_extensions.rb:90:in `build_arel'
activerecord (3.1.3) lib/active_record/relation/query_methods.rb:196:in `arel'
activerecord (3.1.3) lib/active_record/relation.rb:397:in `to_sql'
```

my model is very basic - Split belongs_to transfer.