[英]Error deleting a join table record
I have a join table named favorites
. 我有一个名为
favorites
的联接表。 It doesn't have a single auto incrementing id. 它没有单个自动递增ID。 It uses both
user_id
and doctor_id
. 它同时使用
user_id
和doctor_id
。
My issue is when trying to delete this record. 我的问题是尝试删除此记录时。 On Rails 5.0 and 5.1 it throws the following error.
在Rails 5.0和5.1上,它将引发以下错误。
favorite = Favorite.first
=> #<Favorite:0x007fe8b1546bf8 user_id: 3, doctor_id: 2, created_at: Wed, 19 Apr 2017 03:37:10 UTC +00:00, updated_at: Wed, 19 Apr 2017 03:37:10 UTC +00:00>
favorite.delete
NoMethodError: undefined method `to_sym' for nil:NilClass
Am I supposed to be deleting this record some other way or is this a bug? 我是否应该以其他方式删除此记录,或者这是一个错误?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.