diff options
Diffstat (limited to 'railties/lib/generators/active_record/model/model_generator.rb')
-rw-r--r-- | railties/lib/generators/active_record/model/model_generator.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/railties/lib/generators/active_record/model/model_generator.rb b/railties/lib/generators/active_record/model/model_generator.rb index 54187aede0..2641083e0d 100644 --- a/railties/lib/generators/active_record/model/model_generator.rb +++ b/railties/lib/generators/active_record/model/model_generator.rb @@ -12,10 +12,8 @@ module ActiveRecord class_option :parent, :type => :string, :desc => "The parent class for the generated model" def create_migration_file - if options[:migration] && options[:parent].nil? - file_name = "create_#{file_path.gsub(/\//, '_').pluralize}" - migration_template "migration.rb", "db/migrate/#{file_name}.rb" - end + return unless options[:migration] && options[:parent].nil? + migration_template "migration.rb", "db/migrate/create_#{table_name}.rb" end def create_model_file |