Monthly Archives: July 2009

RubyOnRails named_scope Lambda parameters

Most people know of named_scope, but they don’t understand the power of it in conjunction with lambda. Well, I was in a situation where I needed to fetch reports based on a day, month, year and combination. Here is an example of how I need to call my reports:
123Report.date(2009).all # by year
Report.date(2009, 07).all # by [...]