我试图使用类似于
的调用来销毁对象MyObject.destroy_all({:user_id => current_user.id, :item_type_id => params[:type_id], :item_id => params[:item_id]})
Rails将其生成为SQL命令:
User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
MyObject Load (0.2ms) SELECT `my_objects`.* FROM `my_objects` WHERE `my_objects`.`user_id` = 1 AND `my_objects`.`item_type_id` = 3 AND `my_objects`.`item_id` = 9
(0.1ms) BEGIN
SQL (0.4ms) DELETE FROM `my_objects` WHERE `my_objects`.`` = NULL
最后一个SQL语句导致此错误(这是有道理的)
Mysql2::Error: Unknown column 'my_objects.' in 'where clause': DELETE FROM `my_objects` WHERE `my_objects`.`` = NULL
我做错了吗?
Rails 3.2.1 mysql2 0.3.11 mysql 5(我认为)