Would I use a helper for this situation?

I have a layout that is used over two controllers (admin and login).
Each controller has their own navigation. Can I do something like this?

<%= getNavigation(“admin”) %> or <%= getNavigation(“login”) %>

And return the navigation list depending on the string sent?

Seth B.


You could do it the way you suggest or…

  1. use a component to render the navigation, or
  2. use a partial template

personally I reserve helpers for methods that do some work, if it is all
just ‘view’ stuff (like links, etc), I would just put it in a partial.