Working my way through video three of Intermediate Rails, and I cannot for the life of me understand why I’m getting this error when I refresh my dashboards#show page.
My controller looks like this, as per the refactor:
class DashboardsController < ApplicationController
def show
@dashboard = Dashboard.new(current_user)
end
end
And my dashboard model looks like this:
class Dashboard
#removed additional working code for brevity
def shouts
@user.shouts
end
end
My dashboards#show page includes this line, which is throwing the error:
<%= render @dashboard.shouts %>
I’ve tried playing with this in the console, and if I create a user that has some shouts, then create a new dashboard with that user and call dashboard.shouts, I just keep getting an undefined method shouts for dashbaord error.
I can’t see what’s going wrong, so any insight would be appreciated.
Thank you!