I'm trying to split up a web site into two sections. One which should use the application layout and one that should use the admin layout. In my application.rb I created a function as follows:
def admin_layout
if current_user.is_able_to('siteadmin')
render :layout => 'admin'
else
render :layout => 'application'
end
end
And in the controllers where it might be one or the other I put
before_filter :admin_layout
This works fine for some pages (where its just text) but for others I get the classic error:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
Does anyone have an idea of what I'm missing? How should I properly use render and layout?