1👍
✅
You’re getting the error because @sala
is nil and you’re trying to call messages
on a nil object.
If we look at your controller code, @sala
is set in set_sala
which is called before every action. Looking at your logic, if params[:sala_id]
is not there then @sala
will not be set.
Note your GET
request – Started GET "/messages" for 127.0.0.1 at 2019-11-21 15:06:01 +0100
– the param sala_id
is not present and thus the error.
Source:stackexchange.com