diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 18:26:58 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-06-23 18:26:58 +0000 |
commit | c4075292fac0032c0df73c724e13298817f77e52 (patch) | |
tree | 296494a1f11c6dca1f6db9848ce8d59d9dac8522 /railties/lib/rails_generator/generators/components/resource/resource_generator.rb | |
parent | 1a0cdf74be951f9e732cfb8e6e1cd8a087c8ebdf (diff) | |
download | rails-c4075292fac0032c0df73c724e13298817f77e52.tar.gz rails-c4075292fac0032c0df73c724e13298817f77e52.tar.bz2 rails-c4075292fac0032c0df73c724e13298817f77e52.zip |
Added --skip-migration option to scaffold and resource generators (closes #8656) [Michael Glaesemann]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7108 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails_generator/generators/components/resource/resource_generator.rb')
-rw-r--r-- | railties/lib/rails_generator/generators/components/resource/resource_generator.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/generators/components/resource/resource_generator.rb b/railties/lib/rails_generator/generators/components/resource/resource_generator.rb index 5d9eefb5b2..cb0952dab8 100644 --- a/railties/lib/rails_generator/generators/components/resource/resource_generator.rb +++ b/railties/lib/rails_generator/generators/components/resource/resource_generator.rb @@ -1,4 +1,6 @@ class ResourceGenerator < Rails::Generator::NamedBase + default_options :skip_migration => false + attr_reader :controller_name, :controller_class_path, :controller_file_path, @@ -57,7 +59,14 @@ class ResourceGenerator < Rails::Generator::NamedBase "Usage: #{$0} resource ModelName [field:type, field:type]" end - def model_name + def add_options!(opt) + opt.separator '' + opt.separator 'Options:' + opt.on("--skip-migration", + "Don't generate a migration file for this model") { |v| options[:skip_migration] = v } + end + + def model_name class_name.demodulize end end |