unique values

<% for city in @rooms.map(&:city).uniq.sort %>    <option value="<%= city %>"><%= city %></option> <% end %>

or even: Parked at Loopia

<%= options_for_select(@rooms.map(&:city).uniq.sort) %>

If you needed the value to be the city_id rather than the city (name), you could:

<%= options_for_select(@rooms.map { |r| [ r.city, r.city_id ] }.uniq.sort) %>

(Of course, this begins to be a bad example as it doesn't sound like Room belongs_to :city anyway.)

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com Skype: rob.biedenharn