I want to build a select tag with only specific days for example Mon ... Fri, how can I generate that in rails 2 ?
+5
A:
I can't quite believe this is really what you want but
options_for_select(["Mon", "Tue", "Wed", "Thu", "Fri"])
does what you've asked ;)
SteveRawlinson
2010-10-19 12:05:17
With an extra " after "Tue 8)
Reuben Mallaby
2010-10-19 14:37:19
Fixed missing "
Shadwell
2010-10-19 16:31:44
+3
A:
Maybe use something like calendar date select. You can then indicate that certain dates can be disabled as indicated here. Would look something like:
<%= calendar_date_select_tag "week_day", "",
:valid_date_check => "date.getDay() != 0 && date.getDay() != 6 " %>
Shadwell
2010-10-19 12:10:05