Hi,
I am having problems with my page. I have a banner and navigation bar in
controller_name.rhtml in app/views/layout. Can someone please help?
Thanks
In the navigation bar, I have the following links:
Category1
Sub-Category1
Sub-Category2
Sub-Category3
Sub-Category4
Sub-Category5
Sub-Category6
In the main content, I have the following links:
Sub-Category1 edit delete
Sub-Category2 edit delete
Sub-Category3 edit delete
Sub-Category4 edit delete
Sub-Category5 edit delete
Sub-Category6 edit delete
When I click the Sub_Category link in either the navigation bar or the
main content, I should be directed to another page where the
Sub-Category’s children will be shown. But instead I have these errors:
NoMethodError in SubCategory#read
undefined method `each’ for #SubCategory:0x351c414
<% end %> 28:
The following are my rhtml
…app/views/layout/categories.rhtml…
IGMON Webnav<%= javascript_include_tag :defaults %>
<%= stylesheet_link_tag “style”, “scaffold” , “depot” , :media => “all”
%>
<%= @page_title || “Show Sub-Category” %>
<% @subcategory.each do |p| %>
<%= link_to p.name, { :controller => “subsubcat”, :action =>
“subsubcat_list”, :id => p.id } %>
<% end %>
</div>
</div>
<% if flash[:notice] -%>
<% end -%>
<%= yield :layout %>
…app/views/…/SubCategory.rhtml…
List of Sub-Categories
<% @subcategory.each do |p| %>
<% end %>
<%= link_to p.name, { :action => "read", :id => p.id } %> | <%= p.last_updated %> | <%= link_to "Copy", { :action => "copy", :id => p.id} %> | <%= link_to "Delete", { :action => "delete", :id => p.id}, {:post => true, :confirm => 'Are you sure you want to delete?'} %> | <%= link_to
"Add pass", {:controller => "pass", :action => "pass", :id => p.id}
%> |
<%= button_to “Add Sub-Category”, :action => :new, :id => :new %>