Rails 2.3 has a lot of fun features that are proving to be handy.
We have been excited to try some out and we had a chance yesterday to use Dynamic Scopes in MySql finds.
Dynamic Scopes work a lot like Named Scopes in that you can use them as clean ways to filter, select, or order data with out creating a long sql definition.
The neat thing is that the new Dynamic Scopes work like the dynamic findbyXX.
So if if you have a unique scope, but do not want to clutter your model with named_scopes you only use once or twice, you can do:
Model.scoped_by_user_id_and_id(current_user.id, :id)
And that will find perform a sql query based on user_id and id.
You can even add other scopes or finds at the end like:
Model.scoped_by_show_on_index(true).find(all, :limit => 10)
or
Model.scoped_by_show_on_index(true).order_by_name
You can read more on Dynamic Scopes by visiting Ryan Daigle's Blog or Ryan Bates' Screencast