Hi, I’m pretty new at rails like many of the others here and I’m having
a very strange problem.
I’m trying to make a dynamic Ajax menu (food menu) for a restaurant site
I’m developing to display the restaurant’s dishes. Here’s the basic
setup of the menu:
Lunch
-Appetizers
-menu item
-menu item
-Salads
-Entres
When a user clicks on lunch, I want the sections to appear, when the
user clicks on the section, I want the entre to appear, etc.
For the moment, for simplicity’s sake I’ve set it up so when the user
clicks on the lunch it loads a page(lunch_section) which renders a
partial(_section) of sll the menu items.
Here’s where it gets weird. I can get the thing to get the info from the
database and display it alright but it displays the entire layout in the
div. So I put render(:layout => false) in the controller under the
lunch_section model, I get an error message that says:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Extracted source (around line #4):
1: