ernie/squeel — pull request #215 by chewi (2013-01-25 12:43:22+00:00)
Title: Proof of concent: Value literals

It bothered me a lot that you can't do something like this in Squeel.

```ruby
Model.where{"bob".in [ foo, bar, baz ]}
```

I'm guessing this is because you didn't want to pollute the string class, which is fair enough, but I felt there should be a compromise because the alternative isn't very nice.

```ruby
t = Model.arel_table
Model.where(Arel::Nodes::In.new("bob", [ t[:foo], t[:bar], t[:baz] ])
```

I figured that all you need to do is wrap the string in some dummy class so I quickly knocked up a proof of concept. Now you can do this.

```ruby
Model.where{to_s("bob").in [ foo, bar, baz ]}
```

I obviously don't expect you to merge this as-is, I just wanted to know your thoughts about whether it would be worth expanding upon. The same trick could be applied to other core types like integers and floats. In fact, you may not even need separate classes for these, a single Squeel::Nodes::ValueLiteral class might be sufficient as long as Arel knows what to do the underlying instance.