Merry X'mas first
I have "Product","Category","Subcategory" 3 Model, and when new
"Product", I want to use "Dynamic Select Menus" just like Ryan
mentioned in http://railscasts.com/episodes/88-dynamic-select-menus
I have everything down. But when I visit the js file, I got following
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
Extracted source (around line #3):
2: var subcategories = new Array();
3: <% for subcategory in @subcategories -%>
4: categories.push(new Array(<%= category.id %>, '<%=h
subcategory.subcategory_name %>', <%= subcategory.id %>));
5: <% end -%>
Anyone got an idea, how does it happen?
@subcategories = Subcategory.find(:all)
Thank you very much for help.
I checked my codes again, yes I made a typo here, it should be
can get the array
But, question comes again
I can get category and subcategory list in my item/new view
But, when I change the value of category the value of subcategory
I checked with web inspector, I got this error message"TypeError:
Value undefined (result of expression document.observe) is not
It seems my result of document.observe is not correct?
How can I fix it?
Finally I figured it out.
Now everything goes fine.
Thank you very much for your help.