Topic: Help: DRYer Class Methods
I have several models that make use of the same class methods in a controller. Writing these methods into each model doesn't seem very DRY... how do I make them accessible to my controllers without rewriting them in each model?
For example, in a controller, I'd like to use the find_ascending class method for the Category and Subcategory models:
@categories = Category.find_ascending
@subcategories = Subcategory.find_ascending
I have the following class method in both the Category and Subcategory models:
# Finds all rows and orders them ascendingly
find(:all, :order => "position ASC")
What's the best practice here? Thanks.