I\'m a Rails beginner and I\'m working on a preexisting Rails 2 project. In my application, I tried converting a select dropdown field to a form_handler f.select, but I\'m getti
Place the following in a helper file
def select_options_for_locations(locations)
locations.map do |location|
[location_string(location.masterlocation), location.masterlocation.street_address]
end
end
def location_string(masterlocation)
"#{masterlocation.city}, #{masterlocation.state}, #{masterlocation.zip} #{masterlocation.name}"
end
Then in your view, you can use the following
= f.select :start, select_options_for_locations(@itinerary.locations), {}, :id => "startdrop"