jeudi 15 septembre 2022

NoMethodError : Undefined method in NilClass

I'm currently accessing the same piece of code from two routes in two different files. I have the code in file X which is rendering or accessing by a link. I created a file Y and copy pasted same code present in X and rendering this particular file from a different link in routes file. For example - two different links -

 get '/holdings/:holding_name/board ,to : 'dashboard/x

 get '/scoldings/:scolding_name/board ,to : 'dashboard/y 

I've created file Y and copy pasted code from file X which has a method named .operations. Please don't ask me why I have to create file Y when I can render to file X itself. I have to do it. So, I'm getting an error :

undefined method `operations' for nil:NilClass

when trying to call file Y. But everything is file when I'm accessing file X. Can someone please explain the root cause. Thankyou!

Aucun commentaire:

Enregistrer un commentaire