Hi,
I have a model Post that I want to assign to section, sub_section and sub2_sections. My models are set up as follows...
Post belongs_to :section belongs_to :sub_section belongs_to :sub2_section
Section has_many :sub_sections
Sub_Section belongs_to :section has_many :sub2_sections
Sub2_Sections belongs_to :sub_section
I have a form that is using AJAX requests to populate 3 collection_select menus in turn. (Choose a section which populates sub_section, choose a sub_section which populates sub2_section.
This all works great and I can submit the form, the post is saved... in the logs you can see that "sub2_section_id" which is a column in my Post table is set to "4" but when it goes to insert it into the table it becomes "NULL"
When you go back into the post to edit it, obviously, hasn't recorded the sub2_section and it appears blank (but with the correct sub2_sections in the dropdown again.