aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-07-23 20:01:56 +0200
committerXavier Noria <fxn@hashref.com>2016-07-23 20:22:20 +0200
commit99cf7558000090668b137085bfe6bcc06c4571dc (patch)
tree33511db166bdbaa76ccd29a29daaf6bf343f149d /activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
parent1ca571cc472ffea2dfab43ee57d8204e89d5b1a6 (diff)
downloadrails-99cf7558000090668b137085bfe6bcc06c4571dc.tar.gz
rails-99cf7558000090668b137085bfe6bcc06c4571dc.tar.bz2
rails-99cf7558000090668b137085bfe6bcc06c4571dc.zip
systematic revision of =~ usage in AR
Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/migration/migration_generator.rb')
-rw-r--r--activerecord/lib/rails/generators/active_record/migration/migration_generator.rb2
1 files changed, 1 insertions, 1 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 4e5872b585..54c958e30b 100644
--- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
+++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
@@ -60,7 +60,7 @@ module ActiveRecord
# 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]+$/
+ unless /^[_a-z0-9]+$/.match?(file_name)
raise IllegalMigrationNameError.new(file_name)
end
end