mirror of https://github.com/rails/rails
Added --skip-timestamps to generators that produce models (closes #10036) [tpope]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8070 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
3953839e99
commit
ee1ad762a4
|
@ -1,5 +1,5 @@
|
|||
class ModelGenerator < Rails::Generator::NamedBase
|
||||
default_options :skip_migration => false, :skip_fixture => false
|
||||
default_options :skip_timestamps => false, :skip_migration => false, :skip_fixture => false
|
||||
|
||||
def manifest
|
||||
record do |m|
|
||||
|
@ -35,6 +35,8 @@ class ModelGenerator < Rails::Generator::NamedBase
|
|||
def add_options!(opt)
|
||||
opt.separator ''
|
||||
opt.separator 'Options:'
|
||||
opt.on("--skip-timestamps",
|
||||
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
|
||||
opt.on("--skip-migration",
|
||||
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
||||
opt.on("--skip-fixture",
|
||||
|
|
|
@ -3,8 +3,10 @@ class <%= migration_name %> < ActiveRecord::Migration
|
|||
create_table :<%= table_name %> do |t|
|
||||
<% for attribute in attributes -%>
|
||||
t.<%= attribute.type %> :<%= attribute.name %>
|
||||
<% end %>
|
||||
<% end -%>
|
||||
<% unless options[:skip_timestamps] %>
|
||||
t.timestamps
|
||||
<% end -%>
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ResourceGenerator < Rails::Generator::NamedBase
|
||||
default_options :skip_migration => false
|
||||
default_options :skip_timestamps => false, :skip_migration => false
|
||||
|
||||
attr_reader :controller_name,
|
||||
:controller_class_path,
|
||||
|
@ -62,6 +62,8 @@ class ResourceGenerator < Rails::Generator::NamedBase
|
|||
def add_options!(opt)
|
||||
opt.separator ''
|
||||
opt.separator 'Options:'
|
||||
opt.on("--skip-timestamps",
|
||||
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
|
||||
opt.on("--skip-migration",
|
||||
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ScaffoldGenerator < Rails::Generator::NamedBase
|
||||
default_options :skip_migration => false
|
||||
default_options :skip_timestamps => false, :skip_migration => false
|
||||
|
||||
attr_reader :controller_name,
|
||||
:controller_class_path,
|
||||
|
@ -76,6 +76,8 @@ class ScaffoldGenerator < Rails::Generator::NamedBase
|
|||
def add_options!(opt)
|
||||
opt.separator ''
|
||||
opt.separator 'Options:'
|
||||
opt.on("--skip-timestamps",
|
||||
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
|
||||
opt.on("--skip-migration",
|
||||
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue