instance method
copy_table_contents
Ruby on Rails edge
Since v5.1.7 Private — implementation detail, not part of the public APISignature
copy_table_contents(from, to, columns)
No documentation comment.
Parameters
-
fromreq -
toreq -
columnsreq -
renameopt = {}
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