diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-08-16 17:00:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 17:00:14 -0400 |
commit | 7c839024458b1d3d912f1eee3f38691d710ebf1e (patch) | |
tree | 58c7b27738338960e946268a4d08770822ef0abd /activerecord/lib | |
parent | 02c25c3cd419e93fc3882155611a4f8aa757ff3a (diff) | |
parent | b49c6dcecd08941e0baa2edea922f838f099780d (diff) | |
download | rails-7c839024458b1d3d912f1eee3f38691d710ebf1e.tar.gz rails-7c839024458b1d3d912f1eee3f38691d710ebf1e.tar.bz2 rails-7c839024458b1d3d912f1eee3f38691d710ebf1e.zip |
Merge pull request #30048 from yahonda/regexp_aware_schema_dumper_prefix_suffix
Allow `table_name_prefix` and `table_name_suffix` have `$`
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 27a1c89bd1..fd644225ca 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -243,7 +243,9 @@ HEADER end def remove_prefix_and_suffix(table) - table.gsub(/^(#{@options[:table_name_prefix]})(.+)(#{@options[:table_name_suffix]})$/, "\\2") + prefix = Regexp.escape(@options[:table_name_prefix].to_s) + suffix = Regexp.escape(@options[:table_name_suffix].to_s) + table.sub(/\A#{prefix}(.+)#{suffix}\z/, "\\1") end def ignored?(table_name) |