Imagine a typical, modern web app - where in the navbar or some navigation element that runs along the top there is a
notifications menu where it tells the user how many notifications they have received since last visiting.
It also may have a dropdown menu that they can clear off existing notifications or just view them.
Given that these notifications need to be present across all views, where should I put the logic for that? In my
ApplicationController? That feels wrong, for some reason - but I can’t see any other explanation.
Also, should I put the actual partials within the generic
For those apps that have a
Dashboard controller (i.e. a non-restful resource) that just acts as the central hub for a lot of this info, what’s the best way to approach this? In terms of structuring partials that will be included in the
I have stumbled across the Facade pattern as pointed out by Thoughtbot. But I still have some questions.
application.html.erb, I have a partial being rendered -
<%= render partial: "shared/navbar" %>. In that partial, I want to be able to call somethings (e.g. that
@notifications). How would I access that instance variable and other shared variables/resources on other partials that would be declared in this