aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2015-04-28 14:00:45 -0700
committerZachary Scott <e@zzak.io>2015-04-28 14:00:45 -0700
commit8979a5a4bd5cd570655ef66794140ad9212dcb0f (patch)
tree11346cc2c1d5a0577bca74bec4d20e7dc036b11c
parentf4b8b58f72cb50d329fb304201c07e8023efe32c (diff)
parentf63d141eaf1d9c1a50c6fe371e915b5d34622f72 (diff)
downloadrails-8979a5a4bd5cd570655ef66794140ad9212dcb0f.tar.gz
rails-8979a5a4bd5cd570655ef66794140ad9212dcb0f.tar.bz2
rails-8979a5a4bd5cd570655ef66794140ad9212dcb0f.zip
Merge pull request #19945 from thenickcox/migration_generator_docs
[ci skip] Correct grammar, add docs to ActiveRecord migration generator
-rw-r--r--activerecord/lib/rails/generators/active_record/migration/migration_generator.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
index 7a3c6f5e95..0d57de4d65 100644
--- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
+++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
@@ -14,10 +14,9 @@ module ActiveRecord
protected
attr_reader :migration_action, :join_tables
- # sets the default migration template that is being used for the generation of the migration
- # depending on the arguments which would be sent out in the command line, the migration template
- # and the table name instance variables are setup.
-
+ # Sets the default migration template that is being used for the generation of the migration.
+ # Depending on command line arguments, the migration template and the table name instance
+ # variables are set up.
def set_local_assigns!
@migration_template = "migration.rb"
case file_name
@@ -56,6 +55,8 @@ module ActiveRecord
attributes.select { |a| !a.reference? && a.has_index? }
end
+ # A migration file name can only contain underscores (_), lowercase characters,
+ # and numbers 0-9. Any other file name will raise an IllegalMigrationNameError.
def validate_file_name!
unless file_name =~ /^[_a-z0-9]+$/
raise IllegalMigrationNameError.new(file_name)