sansan-event-fusion / spark-2023-teamP-backend

1 stars 0 forks source link

/recruitmentsにアクセスするとエラーが出る #5

Closed kanatatsu64 closed 1 year ago

kanatatsu64 commented 1 year ago

対象ブランチ

develop

操作

GET /recruitments

内容

railsのコンソールに下記のエラーがでる。

web_1  | Started GET "/recruitments" for 172.22.0.1 at 2023-09-12 07:43:07 +0000
web_1  | Cannot render console from 172.22.0.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
web_1  | Processing by RecruitmentsController#index as */*
web_1  |   Recruitment Load (5.5ms)  SELECT `recruitments`.* FROM `recruitments`
web_1  |   ↳ app/controllers/recruitments_controller.rb:44:in `map'
web_1  | Completed 500 Internal Server Error in 124ms (ActiveRecord: 5.5ms | Allocations: 6259)
web_1  |
web_1  |
web_1  |
web_1  | NoMethodError (undefined method `user' for #<Recruitment id: 1, user_id: 1, title: "ハッカソンメンバー募集", description: "フロントエンドのメンバー募集中です", image: "hack.jpg", area: "大阪", people_limit: 5, participants_count: 3, created_at: "2023-09-12 05:43:40.636695000 +0000", updated_at: "2023-09-12 05:43:40.636695000 +0000">
web_1  | Did you mean?  user_id):
yagi-73 commented 1 year ago
class Recruitment < ApplicationRecord
  belongs_to :user

アソシエーションの追加で修正