rails/rails — Issue #3328: Where hash with conditional SQL parameters
Author: azizmb
Created: 2011-10-14 06:30:37+00:00
State: open

It would be great if we could use the `where` function in its Hash syntax with conditional SQL parameters. This would allow creation of complex queries without having to resort to strings.

An example implementation (borrowing syntax from Django)

```ruby
Person.where(:name__like => "%james%", :age__gte => 30)
```

This would result in SQL:

```sql
WHERE name LIKE "%james%" AND age >= 30
```

Im a bit new to Rails, so i dont know where this would fit exactly, but il hopefully have a patch by the weekend