RE: How to test for controller


#1

There is a reason the controller is called controller. The controller
should be making this type of decision.

I would do it this way:

Class FooController < ApplicationController
def bar
@side_nav = :display_admin
End
def baz
@side_nav = :hide_admin
EndEnd

In the view:
<% if @side_nav == :display_admin %>

<% end %>

In your application controller, you can set a default value for the
@side_nav variable to avoid needing to set it in every action