Maybe this is super-trivial…
I need to have a list of links on the left hand side of my application,
for every single page.
So, I’ve created a layout called “main” (main.rhtml) under
view/layouts, and included >layout “main”< in pretty all of my
main.rhtml has, amongst all the other HTML stuff:
<%= render_component :controller=> ‘dli/extras’, :action=>
This is the component to display the links:
class Dli::ExtrasController < ApplicationController
@links << Link.new(“Channels”, “/lookup/channel”, “index”)
@links << Link.new(“Password durations”,
Now: the list of links will need to change according to the user’s
permission. So, there is quite a lot of logic involved here.
What are my options, if I don’t want to use components?
The only solution I can think of is to add a method to the general
application controller (application.rb). However, how do call such an
action from main.rhtml? It looks like I need to be able to specify
controller and action, which brings me back to components…
Can somebody please enlighten me? I feel that I am heading the wrong