So I haven't been doing this for long but I'm completely stuck on this. I have a model which looks like this (simplified for brevity):
class ReqBreakdown < ActiveRecord::Base
belongs_to :next_level #nil if lowest level
belongs_to :previous_level #nil if highest level
belongs_to :requirement_level
end
I need a way to build these lists from the UI. I had initially envisioned using linked drop-downs like those described here: http://blog.jatinder.me/2006/09/cascading-select-boxes-with-rjs.html but I can't even get it to call the action on my controller. I copied the described javascript into my application.js, made sure it was included in my layout, added the helper to application_helper.rb, and added the supporting actions to my controller, but no luck. Honestly, I'm not even sure it will meet my requirements. The rules for selection are:
- Up to 4 levels (i.e. 4 select boxes).
- No circular references (i.e. all previously selected items must be removed from the next text-box to be selected)
- Selected objects are all of the same type (requirement_level)
Any suggestions?