Ruby on Rails select_tag default value

2 Mar 2009

When using the Rails helper select_tag, the selected value (ie highlighted value) is a parameter to options_for_select, not select_tag.

Eg:

Number of Rows: <%= select_tag(:numrows, options_for_select(%w{10 20 50 100 200 500}, session[:numrows])) %>

(much head-banging-against-wall went into working this out.)

comments powered by Disqus

  « Previous: Next: »