how to get date_select to default to unused date?

I've got a simple form that uses date_select and I'd love to have it
automatically choose the next open date (bonus points: have it skip
weekends). How would I do this?

Thanks so much!


see the options list, :default


Hmmm. So I did this:

<%= date_select ('story', 'rundate', :default => nil) %></p>

and it didn't do anything--the date select still shows today's date.

Of course, the "nil" was a wild guess, so I tried the 3.days.from_now
that's in the example and it also showed today's date.

So, what am I doing wrong?


Still hoping for some help with this:

I want date_select to automatically default to the next available
calendar date--my app schedules things in advance, so that date may be
a ways away.

I can't seem to figure out how to do this.

Bonus complication: How would I get it to skip weekends in this

Does @story.rundate already have a value? I'm pretty sure that the
:default option only applies if the attribute is not already set.

If you are editing an existing story then I'd think you'd want to
initialize the select to the current value.

If you're creating a new story, then I think you want to initialize a
new Story to have the rundate attribute set to the next open date
before rendering the view.

Now how you calculate that next open date is a matter of your own domain logic.