From 99cf7558000090668b137085bfe6bcc06c4571dc Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 23 Jul 2016 20:01:56 +0200 Subject: systematic revision of =~ usage in AR Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with? --- .../lib/rails/generators/active_record/migration/migration_generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/rails/generators/active_record') 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 -- cgit v1.2.3