I just can’t figure out how to do it, i’m sure it’s pretty simple: I
have a model Order with a few named_scope methods
(:completed, :incompleted, :recent). Now I’d like to define a method
that returns the latest date an order was placed. The method shouldn’t
just do this over the entire collection of orders, but also over any
of the scopes. I know how to define a method within a specific scope
(named_scope :recent do def latest_date <…> end end), but surely
there’s a way I don’t need to define it 3 times to be able to access
it within each scope?
If I define the class method Order#latest_date, how can I call it on a
subset of orders, either found by a named_scope or any other
find(:conditions => …) method?