Forum: Rails Engines Datebox initialization, dumb question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Greg F. (Guest)
on 2006-02-21 01:25
(Received via mailing list)
I've just been testing out the dateboxes I created Friday.

They seem to be working good except I had a couple I wanted to
initialize with today's date.

With the scaffold code it happened automatically.

With the datebox engine I'm having to do it manually.

I'm using ':date_started => Time.now.strftime("%m/%d/%Y")'

Is there another preset variable floating around that would be cleaner?

Greg
--
Greg F.
The Norcross Group
Forensics for the 21st Century
Henning P. (Guest)
on 2006-02-21 10:46
Greg F. wrote:
> I've just been testing out the dateboxes I created Friday.
>
> They seem to be working good except I had a couple I wanted to
> initialize with today's date.
>
> With the scaffold code it happened automatically.
>
> With the datebox engine I'm having to do it manually.
>
> I'm using ':date_started => Time.now.strftime("%m/%d/%Y")'
>
> Is there another preset variable floating around that would be cleaner?

If it's datetime:

:date_started => Time.now()

If it's date:

:dated_started => Date.today()
Greg F. (Guest)
on 2006-02-21 19:38
(Received via mailing list)
On 2/21/06, Henning P. <removed_email_address@domain.invalid> wrote:
> > I'm using ':date_started => Time.now.strftime("%m/%d/%Y")'
> >
> > Is there another preset variable floating around that would be cleaner?
>
> If it's datetime:
>
> :date_started => Time.now()
>
> If it's date:
>
> :dated_started => Date.today()

Thanks,

I saw the Date class in the ruby book, but not the today() method.

Greg
--
Greg F.
The Norcross Group
Forensics for the 21st Century
This topic is locked and can not be replied to.