views:

41

answers:

2

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
With an extra " after "Tue 8)
Reuben Mallaby
Fixed missing "
Shadwell
+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