Drying up Code

First, make a method in each of those models called 'title_for_links',
which returns the appropriate bit of text. That'll standardise all of
those different method calls.

Then you could have something like:

def link_to_object(object)
  link_to(object.title_for_links, :controller =>
object.class.name.downcase, action => :show, :id => object.id)

assuming that the appropriate controller is always a lowercase version
of the object's class name.


I like this approach. Simple and elegant. Thanks.