【发布时间】:2016-10-18 17:12:06
【问题描述】:
我无法在 Rails 中销毁对象(使用 Rails 4.2.3)。下面代码中的这一行
user_my_object_time_match.destroy
因错误而失败
wrong number of arguments (given 0, expected 1)
这将在另一个模型的事务中被删除,如果这很重要的话。下面是周边交易
def delete_my_object_and_any_matching_records
transaction do
linked_my_object = self.linked_my_object
if destroy
if !linked_my_object.nil?
user_my_object_time_match = UserMyObjectTimeMatch.joins(:my_object_time).where("my_object_time_id = ?", linked_my_object.my_object_times[0])
if !user_my_object_time_match.nil?
user_my_object_time_match.destroy
【问题讨论】:
标签: ruby-on-rails-4 model destroy