Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8501 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

[PATCH] Adds timestamps to model generator by default

Reported by: shane Assigned to: core
Priority: normal Milestone: 1.x
Component: Railties Version: edge
Severity: normal Keywords:
Cc:

Description

Brings some of the sexy migrations to generators. Timestamps are now added by default to the migration when a model is generated, per discussion with bitsweat. This also applies to scaffold and resource generators since they both depend on the model generator. The feature can be skipped using the --skip-timestamps option.

I added tests to make sure that timestamps are created in the migration and fixtures. Also updated the usages for model, scaffold, and resource to reflect the change.

Attachments

add_timestamps_to_model_generator_by_default.diff (8.6 kB) - added by shane on 05/28/07 23:11:49.
add_timestamps_to_model_generator_by_default2.diff (7.9 kB) - added by shane on 05/28/07 23:37:15.
Removed the --skip-timestamps option since removing one line from a migration isn't a big deal
add_timestamps_to_model_generator_by_default3.diff (7.7 kB) - added by shane on 05/28/07 23:49:32.
Diff from vendor/rails instead of rails project root.

Change History

05/28/07 23:11:49 changed by shane

  • attachment add_timestamps_to_model_generator_by_default.diff added.

05/28/07 23:37:15 changed by shane

  • attachment add_timestamps_to_model_generator_by_default2.diff added.

Removed the --skip-timestamps option since removing one line from a migration isn't a big deal

05/28/07 23:49:32 changed by shane

  • attachment add_timestamps_to_model_generator_by_default3.diff added.

Diff from vendor/rails instead of rails project root.

05/29/07 00:12:01 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [6883]) Generated migrations include timestamps by default. Closes #8501.

05/29/07 10:46:07 changed by mislav

Hmm, there is no option not to generate timestamps?

05/29/07 17:06:36 changed by shane

I initially had the --skip-timestamps option, but bitsweat and I agreed that removing one line from your migration file is easier for the uncommon case when you don't need timestamps. Actually you would have to remove them from your fixture too, which you have to edit anyway when writing tests.

06/01/07 12:05:47 changed by norbert

Is there a reason why the timestamps line doesn't have the same indentation as the attributes?