This project is archived and is in readonly mode.
time scaffolding uses datetime_select, stores as time
Reported by Simon St.Laurent | March 30th, 2009 @ 05:20 PM | in 3.0.2
In Rails 2.3.2,
script/generate scaffold tester birthday:date favorite_time:time
rake db:migrate
script/server
Then visit http://localhost:3000/testers/.
>The scaffolding will use datetime_select
to
represent the time, but won't store the date information. The odd
result is that the user is asked for and shown the date, but that
information isn't real - it's always 1/1/2000.
Previous versions of Rails also showed and asked for the date
when they generated scaffolding for time data, but didn't throw it
away. The scaffold generation needs to shift to
time_select
to match the expectations of the
underlying datatype.
Comments and changes to this ticket
-
Steve St. Martin April 16th, 2010 @ 01:01 AM
- Assigned user set to Ryan Bigg
verified this behavior still exists on both 2.3.5 and master, this issue is probably not mission critical as scaffolds can be changed easily, please submit a patch. for now can probably as mark incomplete.
-
Ryan Bigg April 16th, 2010 @ 01:26 AM
- State changed from new to incomplete
-
Dan Pickett May 9th, 2010 @ 05:45 PM
- Tag changed from 2.3.2, datetime, scaffold, time, time_select to 2.3.2, bugmash, datetime, scaffold, time, time_select
-
Jeff Kreeftmeijer May 15th, 2010 @ 09:56 AM
I've attached a patch that makes sure the scaffold's _form partial uses
time_select
instead ofdatetime_select
when dealing with time attributes. The first one applies to master and the second one's for 2-3-stable. :) -
Rizwan Reza May 15th, 2010 @ 05:03 PM
- Tag changed from 2.3.2, bugmash, datetime, scaffold, time, time_select to 2.3.2, bugmash, bugmash-review, datetime, scaffold, time, time_select
- State changed from incomplete to verified
-
Jeremy Kemper May 15th, 2010 @ 06:31 PM
- Milestone changed from 3.x to 2.3.6
- State changed from verified to incomplete
No regression test.
-
Rizwan Reza May 15th, 2010 @ 06:45 PM
- Tag changed from 2.3.2, bugmash, bugmash-review, datetime, scaffold, time, time_select to 2.3.2, bugmash, datetime, scaffold, time, time_select
-
Santiago Pastorino May 15th, 2010 @ 08:44 PM
We need to complete test the generation behavior not only the time one.
Please try to do it. -
Jeff Kreeftmeijer May 15th, 2010 @ 10:10 PM
I've attached a patch for master with tests for the Rails::Generators::GeneratedAttribute#field_type method and included my previous patch. What do you think?
I can this for 2-3-stable as well if you guys like it. :)
-
Jeff Kreeftmeijer May 16th, 2010 @ 12:25 AM
One patch, or one commit? The last patch has everything in it (but two commits). :)
-
Santiago Pastorino May 16th, 2010 @ 01:23 AM
- State changed from incomplete to open
- Assigned user changed from Ryan Bigg to José Valim
one commit only
-
Jeff Kreeftmeijer May 16th, 2010 @ 01:31 AM
Ok, I squashed the commits in the master patch and added the same one for 2-3-stable. Here we go. :)
-
Santiago Pastorino May 16th, 2010 @ 01:47 AM
- Milestone cleared.
- State changed from open to verified
Well done Jeff +1 ;).
Wait for José to push to master and 2-3-stable. -
Rizwan Reza May 16th, 2010 @ 02:07 AM
- Tag changed from 2.3.2, bugmash, datetime, scaffold, time, time_select to 2.3.2, bugmash-review, datetime, scaffold, time, time_select
-
Repository May 16th, 2010 @ 09:45 AM
- State changed from verified to resolved
(from [3568c5cee0f37f3302d739472be7477bee1b0d2a]) using :time_select when the attribute type is :time in the scaffold generator. [#2377 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/3568c5cee0f37f3302d739472be747... -
Repository May 16th, 2010 @ 09:53 AM
(from [4750e61bfecd210e5c4d96546d638b5cd23bb09e]) using :time_select when the attribute type is :time in the scaffold generator. [#2377 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/4750e61bfecd210e5c4d96546d638b... -
José Valim May 16th, 2010 @ 10:04 AM
- State changed from resolved to open
Ops, I forgot to apply the patch with tests. I just asked Jeff on #railsbridge to refactor the current tests (using something like assert_attribute_type and remove the code duplication) and provide new patches with only tests!
-
Jeff Kreeftmeijer May 16th, 2010 @ 10:53 AM
And here they are. I've attached a patch for master adding
assert_attribute_type
to DRY things up, with the forgotten tests. Also, one for 2-3-stable. :) -
Repository May 16th, 2010 @ 11:08 AM
- State changed from open to resolved
(from [5ff6de0982c165bb9038258d867398c73c142084]) Added assert_attribute_type to clean up GeneratedAttributeTest [#2377 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/5ff6de0982c165bb9038258d867398... -
Repository May 16th, 2010 @ 11:10 AM
(from [ec017e158a0f006ac30bee94f81411a4d74a5227]) Added assert_attribute_type to clean up GeneratedAttributeTest [#2377 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/ec017e158a0f006ac30bee94f81411... -
Rizwan Reza May 16th, 2010 @ 03:06 PM
- Tag changed from 2.3.2, bugmash-review, datetime, scaffold, time, time_select to 2.3.2, datetime, scaffold, time, time_select
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 2377 time scaffolding uses datetime_select, stores as time (from [3568c5cee0f37f3302d739472be7477bee1b0d2a]) using :...
- 2377 time scaffolding uses datetime_select, stores as time (from [4750e61bfecd210e5c4d96546d638b5cd23bb09e]) using :...
- 2377 time scaffolding uses datetime_select, stores as time (from [5ff6de0982c165bb9038258d867398c73c142084]) Added a...
- 2377 time scaffolding uses datetime_select, stores as time (from [ec017e158a0f006ac30bee94f81411a4d74a5227]) Added a...
- 4631 Rails::Generators::GeneratedAttribute: tests, cleanups and a bugfix After starting writing some tests for Rails::Generators::...