Forum: Ruby on Rails Accessing datetime_select value

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.
Andrew D. Goodfellow (Guest)
on 2006-04-04 20:28
(Received via mailing list)
How do I get a value from datetime_select? Do I need to get each value
from it's dropdown element individually or is there a way to get the
date by referencing one object? Anyone have any good examples?

-Andy
Mark Reginald J. (Guest)
on 2006-04-05 09:36
(Received via mailing list)
Andrew D. Goodfellow wrote:
> How do I get a value from datetime_select? Do I need to get each value
> from it's dropdown element individually or is there a way to get the
> date by referencing one object? Anyone have any good examples?

Rails will automatically instantiate a Time attribute from the set of
component param keys and values if you call new, update_attribute,
or update_attributes with the appropriate part of the params hash.

--
We develop, watch us RoR, in numbers too big to ignore.
Andreas P. (Guest)
on 2006-10-22 03:56
> Rails will automatically instantiate a Time attribute from the set of
> component param keys and values if you call new, update_attribute,
> or update_attributes with the appropriate part of the params hash.

Sorry, I don't get it. I have something like
<%= datetime_select 'bill', 'activity_from'  %>
which generates a bunch of selectors to pick up the date and time... but
how do I access it in the action where the form is posted to?
@from = DateTime.new(params[:bill][:activity_from])
or
@from = params[:bill][:activity_from]
?

Please give me a hint,

Thank you in advance!

Andreas
This topic is locked and can not be replied to.