With_sorting

I thought about posting this in the Ruby mailing list, but my basis for
comparison rests in Rails.

I currently have code that looks something like this:

<%= link_to("Name", { :sort => params[:sort], :dir => params[:dir] }) %> <%= link_to("Address", { :sort => params[:sort], :dir => params[:dir] }) %> ...

I came to the realization that adding a block to wrap those link_tos
and extract out the common elements might be worthwhile. It would
perform something like form_for or with_scope, it seems, and it would
look pretty darned good, too!

Unfortunately, both of those implementations rely on creating new
objects to yield the block to (and furthermore, my block/proc knowledge
isn’t there yet), and it seemed like it might be too much work for not
enough reward.

Is there an easier way I’m not seeing? I can just do a for loop with a
list of values unique to each sortable field (e.g., link text, tag
title, etc.), but even that seems cludgy.

Thanks,
Adam