I have a problem with a function, I tried to achieve a layout
switching according to the user level that’s logged in
the function looks like this
when 3 : render :layout=> ‘admin’
when nil : render :layout=> ‘application’
else render :layout=> ‘nonadmin’
The problem that i have when i use a function like list which uses a
variable @users = User.find(:all)
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
In the view there is
<% for user in @users -%>
I don’t know why this is happening …