instance method copy_table_contents

Ruby on Rails edge

Since v5.1.7 Private — implementation detail, not part of the public API

Available in: v5.1.7 v5.2.8.1 v6.0.6.1 v6.1.7.10 v7.0.10 v7.1.6 v7.2.4 v8.0.5.1 v8.1.4 edge

Signature

copy_table_contents(from, to, columns)

No documentation comment.

Parameters

from req
to req
columns req
rename opt = {}
Source
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 802
        def copy_table_contents(from, to, columns)
          from_columns = columns(from).collect(&:name)
          columns = columns.find_all { |col| from_columns.include?(col) }
          quoted_columns = columns.map { |col| quote_column_name(col) } * ","

          query_command("INSERT INTO #{quote_table_name(to)} (#{quoted_columns})
                     SELECT #{quoted_columns} FROM #{quote_table_name(from)}")
        end

Defined in activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb line 802 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::SQLite3Adapter

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close