Reputation: 516
I have method in my class Site::BaseController < ApplicationController
before_filter :check_layout
def check_layout
if @user.site_theme == 'hometastic'
layout 'hometastic'
else
layout 'agent'
end
end
When i do only
layout 'agent'
it works perfectly
but when i added before_filter
i have got undefined method layout for
Rails 3.2.16
Any suggestions? error screen
Upvotes: 5
Views: 3498
Reputation: 21
just add the following lines of code in application controller:
include ActionView::Layouts
Upvotes: 1
Reputation: 3075
I think middleware for 'layout' is not loaded properly
To load "layout" middleware in your rails application, Write below line to your application controller
include ::ActionView::Layouts
Upvotes: 0