0
Rails 5を使用しています。私はuser_idフィールドに基づいてモデルを検索したいと思います。私のテーブルには、このRails 5では、フィールドの1つに基づいてモデルを検索するときに、未定義のfind_byメソッドを取得するのはなぜですか?
cindex=# \d user_notifications;
Table "public.user_notifications"
Column | Type | Modifiers
--------------------+---------+-----------------------------------------------------------------
id | integer | not null default nextval('user_notifications_id_seq'::regclass)
user_id | integer |
crypto_currency_id | integer |
price | integer | not null
buy
| boolean | not null
のように見えますが、私はそう
@user_notification = UserNotification.find_by_user(current_user)
のようなモデルを検索しようとしたとき、私は、単純な(Railsの)何がエラーに
undefined method `find_by_user' for UserNotification:Class
を取得見る方法私のフィールドをアップ?