Accessing datetime_select value


#1

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


#2

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.


#3

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