11175
(-- --)
June 3, 2008, 2:52pm
1
All morning and last night I have had to work with this bug / or my
fault in the following :
I wish for the user to select an arrival date (m/d/y); the arrival date
is of type datetime.
when I have
Arrives :<%= pu.datetime_select :arrives %>
it gives me the hour and minutes. I can capture the arrival date and see
it being displayed in the controller when I do a logger.debug ( ">>>
arrives #{@unit.arrives }")
I dont want the user to set the hour and minute though (important)
So I type in :
Arrives : <%= pu.datetime_select(:arrives, :discard_hour=>true %>
This results in arrival date not being captured; now when I do a
logger.debug ( ">>> arrives #{@unit.arrives }") I get nothing.
I have tried various permutations and combinations :discard_minute=>true
etc. and it just doesnt seem to work with :discard_hour=>true
What am I doing wrong here?
11175
(-- --)
June 3, 2008, 3:34pm
2
11175
(-- --)
June 3, 2008, 5:30pm
3
Rails Terrorist wrote:
browse here :
railsapi.org - railsapi Resources and Information.
reinhart
http://teapoci.blogspot.com
What does that mean? Does it mean that datetime does not have a
:discard_hour=>true option?
I notice this option here : http://dev.rubyonrails.org/ticket/2089
I even tried this :
http://www.methods.co.nz/rails_date_kit/rails_date_kit.html
but that does not work (tried all kinds of permutations/ combinations).
Any other usable interfaces/plugins would be cool.
Wait a second that is a similar response you gave to this guy :
I am sure people can READ the apis my friend. This particular version
does not mention any discard_hour option either
:ActionView::Helpers::DateHelper
However rails way by Obie Fernandez (2008) on page 415 says :
datetime_select(object_name, method, options = {})
Works exactly like date_select, except for the addition of hour and
minute select tags. Seconds may be added with the option
:include_seconds. Along with the addition of time information come
additional discarding options: :discard_hour, :discard_minute, and
:discard_seconds.
11175
(-- --)
June 3, 2008, 6:01pm
4
Calm down Bro, i think you are too hurry to interpret of written in my
url
I can see your stressful here.
man... you should make it like hashing, you can not use :
<%= pu.datetime_select(:arrives, :discard_hour=>true %>
But if you use :
<%= pu.datetime_select(:bus, :arrives, :discard_hour=>true %>
It would be working 100%
that is why i gave you :
http://railsapi.org/actionview-helpers-datehelper-datetime_select
Cheer,
Reinhart
http://teapoci.blogspot.com
11175
(-- --)
June 3, 2008, 7:00pm
5
calm down bro... you did not read your script carefully
you have made mistake here :
<%= pu.datetime_select (:pso_unit, :arrives ,:discard_hour=>true,
:order=>[:month,:day,:year]) %>
The correct script is
<%= datetime_select (:pso_unit, :arrives ,:discard_hour=>true,
:order=>[:month,:day,:year]) %>
Dont ask me why. I can answer it, but i need you to find answer of this
matter by your self. Because you are impatient programmer and careless
Cheer,
Reinhart
http://teapoci.blogspot.com
11175
(-- --)
June 3, 2008, 7:31pm
6
Rails Terrorist wrote:
you have made mistake here :
<%= pu.datetime_select (:pso_unit, :arrives ,:discard_hour=>true,
:order=>[:month,:day,:year]) %>
The correct script is
<%= datetime_select (:pso_unit, :arrives ,:discard_hour=>true,
:order=>[:month,:day,:year]) %>
I tried that before I tried pu.datetime_select...
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true,
:default=>DateTime.now, :order=>[:month,:day,:year]) %>
does not work either.
This works :
<%= pu.datetime_select :arrives , :order=>[:month,:day,:year] %>
however the moment I add :discard_hour=>true, I can no longer read the
date in the arrives field. I can email the mvc to you. Lastly just a
gentle request : would you be nice enough to please not label me as you
try to help me , thanks! appreciate your kindness.
11175
(-- --)
June 3, 2008, 9:35pm
7
i dont know what is your exactly problem there because i implemented
your script with/out pu and I have always been success without error.
You can email me at booking2heaven@yahoo.com or upload it here.
Regards
Reinhart
11175
(-- --)
June 3, 2008, 9:42pm
8
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true,
:default=>DateTime.now, :order=>[:month,:day,:year]) %>
it works here to me
If you dont want user set hour and minutes, why you not only use
select_date ?? or a plugin like toolbocks (calendar).
Reinhart
11175
(-- --)
June 4, 2008, 11:55am
9
Rails Terrorist wrote:
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true,
:default=>DateTime.now, :order=>[:month,:day,:year]) %>
it works here to me
If you dont want user set hour and minutes, why you not only use
select_date ?? or a plugin like toolbocks (calendar).
Reinhart
Ok then there must be something wrong with my environment/setup or
application. I could send you the code and the data dump if you wish.
I am not using date as opposed to datetime for extensibility reasons.
Thanks for the tip on datetime toolbocks... that is what I was looking
for.
11175
(-- --)
June 4, 2008, 12:07pm
10
Ather Shiraz wrote:
Rails Terrorist wrote:
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true,
:default=>DateTime.now, :order=>[:month,:day,:year]) %>
it works here to me
If you dont want user set hour and minutes, why you not only use
select_date ?? or a plugin like toolbocks (calendar).
Reinhart
Ok then there must be something wrong with my environment/setup or
application. I could send you the code and the data dump if you wish.
I am not using date as opposed to datetime for extensibility reasons.
Thanks for the tip on datetime toolbocks... that is what I was looking
for.
BTW the datetime_select is embedded in this form :
<% form_for :pso, :url=> {:action=>:create} do |f| %>
<% fields_for :pso_unit do |pu| %> ...
<%= datetime_select(:pso_unit, :arrives, :discard_hour=>true,
:default=>DateTime.now, :order=>[:month,:day,:year]) %>
<%end>
<%end %>