“我目前正在使用注意到的 gem 进行通知,并且遇到以下问题:
undefined method `notifications_count=' for #<AppointmentNotifier id: nil, type: "AppointmentNotifier", record_type: "Appointment", record_id: 15, params: {
=>"new Message"}, created_at: nil, updated_at: nil>.
我在任何文件中都找不到错误,并且我没有调用该方法。错误只是突然发生。”
我在所有文件中搜索了任何可能干扰的方法,但我找不到任何东西。我还使用控制台查找错误
当你看到它返回时
undefined method 'xxxxxx'
在 ActiveRecord 对象上。
notifications_count
看起来像属于gem的列noticed
所以我认为它与数据迁移有关结论:
noticed
向表中添加了一些额外的列,您需要运行rails db:migrate首先添加这些新列。