Hi,
I am trying to make a simple nested dynamic menus, where subcategories will be shown based on what I choosed in category. But to make it very simple, I just wanted to render the same thing in the subcategory, whether I choosed "Home" or "Job" (mainly a text of "show the same" will be rendered)
In index.rhtml I have this
<html>
<head>
<%= javascript_include_tag :defaults %>
</head>
<body>
<select id="categories" name="categories">
<option value="1">Home</option>
<option value="2">Job</option>
</select>
<%= observe_field "categories", :update => "subcategories",
:url => { :controller => "hello", :action => "getsubcategories" } %>
<select id="subcategories" name="subcategories">
<option>
</option>
</select>
</bod>
</html>
For controller, I have this
class HelloController < ApplicationController
def index
end
def getsubcategories
puts "Got inside the controller"
end
end
and for getsubcategories.rhtml, there is only 1 line
<option value="<%= subcategory.id %>"><%= "show the same" %>
It shows an error that points to layout.erb, that can not render correctly on the subcategories menu. I recogn that most likely the mistake is in getsubcategories.rhtml, but I tried several different ways, and still the same error.
How can I fix this? Thank you for any guidance