diff options
Diffstat (limited to 'railties/lib/generators')
-rw-r--r-- | railties/lib/generators/active_record/model/model_generator.rb | 8 | ||||
-rw-r--r-- | railties/lib/generators/named_base.rb | 2 |
2 files changed, 3 insertions, 7 deletions
diff --git a/railties/lib/generators/active_record/model/model_generator.rb b/railties/lib/generators/active_record/model/model_generator.rb index 5c6033629f..2641083e0d 100644 --- a/railties/lib/generators/active_record/model/model_generator.rb +++ b/railties/lib/generators/active_record/model/model_generator.rb @@ -12,12 +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? - klass_name = file_path.gsub(/\//, '_') - klass_name = klass_name.pluralize if ActiveRecord::Base.pluralize_table_names - file_name = "create_#{klass_name}" - 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 diff --git a/railties/lib/generators/named_base.rb b/railties/lib/generators/named_base.rb index c2b958e311..cd7aa61b50 100644 --- a/railties/lib/generators/named_base.rb +++ b/railties/lib/generators/named_base.rb @@ -36,7 +36,7 @@ module Rails @class_name = "#{class_nesting}::#{class_name_without_nesting}" end - @table_name.gsub! '/', '_' + @table_name.gsub!('/', '_') end # Convert attributes hash into an array with GeneratedAttribute objects. |