Rails / ActiveRecord 2.3.8でやりたいこと:
AnyModel.connection.create_table( 'temp_any_model', temporary: true, id: false, options: 'like any_model' )
ただし、ARは、テーブルDDLが複製されているため、フィールドリストが空白であっても、生成されたSQLに「()」を追加することを要求します。その結果、次のようになります。
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') like any_model' at line 1:
CREATE TEMPORARY TABLE `temp_any_model` () like any_model
create table
この単純な新しいlike existing
ステートメントを生成するようにARを強制する方法はありますか?
明らかにconnection.execute(string)
?