2 Comments
I used to be a fan of the has_finder gem written by Nick Kallen.
Now with Rails 2.1, this functionnality is built-in so you don’t need to install the gem.
The named_scope method allows you to add finders to any model. A code snippet is worth 10000 words :
Doing this you can chain expressions like this :
Maybe you knew it, maybe you didn’t. If you didn’t, now you know it. (I feel very smart about this last sentence. I think I am going to put this in my room somewhere)
Rate this post :