Article:
  Rolling with Ruby on Rails, Part 2
Subject:   recipe def edit
Date:   2006-03-15 23:56:15
From:   crambo
Ok, so the select list is nice, but it would be even nicer if there was some way to have it prepopulate with the already "selected" element when you "edit" a recipe.


Can't figure out how to do it. Any ideas?


Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Curt Hibbs photo recipe def edit
    2006-03-16 05:57:06  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    Yes, this capability is actually built in to Rails. You want to look at a helper function called "collection_select". You can read about it here:

    http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers