I have the controller:
class PagesController < ApplicationController
protect_from_forgery
layout "pages"
def index
end
def products
end
def company
@enable_sub_menu = true
end
def support
end
def login
end
end
routes file:
App::Application.routes.draw do
root :to => 'pages#index'
##Product / Search Routing
match "products" => "pages#products"
match "products/search" => 'pages#products/search'
match "products/search/pricing" => 'pages#products/search/pricing'
match "products/business/pricing" => 'pages#products/business/pricing'
match "products/business" => 'pages#products/business'
##Company Pages Routing
match "company/team" => 'pages#company/team'
match "company/contact" => 'pages#company/contact'
match "company" => 'pages#company'
match "company/friends" => 'pages#company/friends'
##Support Routes
match "support" => 'pages#suppprt'
##Login Routes
match "login" => 'pages#login'
end
What I am trying to do is on any page the is /company I want to render a partial but on no others to do this I am using this
<%= render :partial => "pages/partials/sub_nav" if @enable_sub_menu %>
Which looks in the controller method and checks to see if it should load the sub_nav partial
It works great for /company but it does not work for sub pages of /company such as /company/team
How can I enable it to load for all sub pages of the method company in the controller?