DRYing up form tags


I find that I have the following appear a lot inside forms in my app:

<% names = SomeAssociatedModel.find(:all, :order => 'name')
<%= f.collection_select :some_id, names, :id, :name %>

Which is basically a select list of names vs. id. I use it when I relate
between associated models (with has_many and belongs_to). I would like
to write a custom tag for it, something like:

<%= f.names_select :some_id, object_to_select_from %> or similar. This
way, I could use it when, say, editing cities that are associated with

<%= f.names_select :state_id, State %>

I also have a select that's yes/no:

<%= f.select :is_active, [['yes',true],['no',false]] %>

that I'd like to turn to:

<%= f.yes_no_select :is_active %>

Any pointers will surely help - thanks.

Instead of writting custom tags, you could write a custom form builder
with methods for those fields ->