Named Scopes Calling Named Scopes

Written by on Aug 10 2012

Here’s another little tid-bit: You can call a named scope from a named scoped. Yes you can.

 

scope by_date, order("date desc")
scope stuff, -> (kind) {where("stuff = ?", kind)
scope pens, stuff("pen")
scope allans, stuff("allan").by_date
Meet
Steven

Hi I'm Steven,

I wrote the article you're reading... I lead the developers, write music, used to race motorcycles, and help clients find the right features to build on their product.

Get Blog Updates