# \[ANN\] New release of ez-where plugin

**URL:** <https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698>\
**Category:** Rails\
**Created:** [June 30, 2006, 10:45pm UTC](https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698 "2006-06-30T22:45:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [June 30, 2006, 10:45pm UTC](https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698/1 "2006-06-30T22:45:18Z")

</div>

Hello friends-

```
There is a new release of the ez-where plugin. This plugin makes it

```

easy to do complex ActiveRecord queries without writing any SQL. Ruby  
operators are mapped to SQL operators like so:

foo == ‘bar’ #=\> [“foo = ?”, ‘bar’]  
foo =~ ‘%bar’ #=\> [“foo LIKE ?”, ‘%bar’]  
foo \<=\> (1…5) #=\> [“foo BETWEEN ? AND ?”, 1, 5]  
id === [1, 2, 3, 5, 8] #=\> [“id IN(?)”, [1, 2, 3, 5, 8]]  
\<, \>, \>=, \<= et all will just work like you expect.

```
So you can use blocks and ruby ops for very complex conditions. Here

```

is a teaser:

# find all articles with title, body or extended LIKE "%#{params

[:search]}%"

# AND (author.name = params[:author] OR comment.body LIKE "%#{params

[:search]}%")

@articles = Article.find\_where(:all, :include =\> [:author,  
{ :comments =\> :users }]) do  
|article, author, comment|  
article.any\_of(:title, :body, :extended) =~ “%#{params[:search]}%”  
any {  
author.name == params[:author]  
comment.body =~ “%#{params[:search]}%”  
}  
end  
=\>[“(articles.title LIKE ? OR articles.body LIKE ?  
OR articles.extended LIKE ?) AND ((authors.name = ?)  
OR (comments.body LIKE ?))”, “%foo%”, “%foo%”, “%foo%”, “Ezra”, “%  
foo%”]

```
More examples on my blog:

```

[http://brainspl.at/articles/2006/06/30/new-release-of-ez\_where-plugin](http://brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin)

Get it here:  
$ script/plugin install svn://rubyforge.org//var/svn/ez-where

Mailing list here:

[http://rubyforge.org/mailman/listinfo/ez-where-devel](http://rubyforge.org/mailman/listinfo/ez-where-devel)

Cheers-  
-Ezra

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [July 1, 2006, 1:42am UTC](https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698/2 "2006-07-01T01:42:58Z")

</div>

On Fri, 2006-06-30 at 13:44 -0700, Ezra Z. wrote:

> foo \<=\> (1…5) #=\> [“foo BETWEEN ? AND ?”, 1, 5]
> 
> # AND (author.name = params[:author] OR comment.body LIKE "%
> 
> }  
> [Ruby on Rails Blog / What is Ruby on Rails for?](http://brainspl.at/articles/2006/06/30/new-release-of-ez_where-plugin)
> 
> Get it here:  
> $ script/plugin install svn://rubyforge.org//var/svn/ez-where

* * *

‘get it here’ should be on your blog too

and by the way - thanks Ezra and Fabien for such a terrific tool

Craig

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [July 1, 2006, 1:52am UTC](https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698/3 "2006-07-01T01:52:26Z")

</div>

On Jun 30, 2006, at 4:41 PM, Craig W. wrote:

> > 
> 
> Craig

Thanks Craig. I added the link to my blog.

Cheers-  
-Ezra

---

<div class="post-metadata">

**Author:** ![ezra\_z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@ezra\_z](https://www.ruby-forum.com/u/ezra_z)\
**Post date:** [July 1, 2006, 10:45am UTC](https://www.ruby-forum.com/t/ann-new-release-of-ez-where-plugin/96698/4 "2006-07-01T10:45:29Z")

</div>

First rate plugin, well done guys  
Harvey

This e-mail has been scanned for all viruses by MessageLabs.
