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: <table cellpadding="0" cellspacing="0">
2: <%
3: odd_or_even = 0
4: for entre in @lunch_menu
5: odd_or_even = 1 - odd_or_even
6: %>
7: <tr valign="top" class="ListLine<%= odd_or_even
%>">
Trace of template inclusion: /app/views/home/lunch_section.rhtml
RAILS_ROOT: ../config/..
Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/views/home/_section.rhtml:4:in
`_run_rhtml_home__section''
#{RAILS_ROOT}/app/views/home/lunch_section.rhtml:1:in
`_run_rhtml_home_lunch_section''
#{RAILS_ROOT}/app/controllers/home_controller.rb:10:in `lunch_section''
This is driving me nuts. Where am I going wrong?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---