diff options
Diffstat (limited to 'railties/lib/rails_generator/generators/components/resource')
-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 |