Find by include nil object error in rails

前端 未结 3 1658
猫巷女王i
猫巷女王i 2021-01-24 03:22

I\'ve been trying hard to solve this problem but i really don\'t know what is happening. I have this small piece of code :

DiscoveredLocation.find_by_user_id(use         


        
3条回答
  •  孤城傲影
    2021-01-24 03:55

    I could be wrong, however to help you out, try DiscoveredLocation.find_by_user_id(user.id, :include => [:boss_kill])

    Lastly, are you sure you are passing a variable called user into the controller? maybe current_user, if you are using a popular auth gem?

提交回复
热议问题