diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails_generator/generators/components/model/model_generator.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/railties/lib/rails_generator/generators/components/model/model_generator.rb b/railties/lib/rails_generator/generators/components/model/model_generator.rb index 2696a31656..fccf30211a 100644 --- a/railties/lib/rails_generator/generators/components/model/model_generator.rb +++ b/railties/lib/rails_generator/generators/components/model/model_generator.rb @@ -1,5 +1,5 @@ class ModelGenerator < Rails::Generator::NamedBase - default_options :skip_migration => false + default_options :skip_migration => false, :skip_fixture => false def manifest record do |m| @@ -14,7 +14,10 @@ class ModelGenerator < Rails::Generator::NamedBase # Model class, unit test, and fixtures. m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb") - m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") + + unless options[:skip_fixture] + m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml") + end unless options[:skip_migration] m.migration_template 'migration.rb', 'db/migrate', :assigns => { @@ -34,5 +37,7 @@ class ModelGenerator < Rails::Generator::NamedBase opt.separator 'Options:' opt.on("--skip-migration", "Don't generate a migration file for this model") { |v| options[:skip_migration] = v } + opt.on("--skip-fixture", + "Don't generation a fixture file for this model") { |v| options[:skip_fixture] = v} end end |