method

remove_prefix_and_suffix

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveRecord::SchemaDumper
remove_prefix_and_suffix(table) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/schema_dumper.rb, line 333
      def remove_prefix_and_suffix(table)
        # This method appears at the top when profiling active_record test cases run.
        # Avoid costly calculation when there are no prefix and suffix.
        return table if @options[:table_name_prefix].blank? && @options[:table_name_suffix].blank?

        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
Register or log in to add new notes.