Using the hidden tag set to nil didn't work in my rails project. It might have to do with the fact that I'm using the Mongoid ODM. I found that unless all the values in the array are valid ids, nothing will change. (I suspect that ActiveRecord just ignores any non-valid values.)
To combat this issue, I set my hidden tag to a string like 'included'. Then in the controller, I used the line
params[:product][:category_ids].delete 'included'
I'm not sure if this is the best solution, but it works.
I wish I had had this when I was first learning Rails. I felt pretty lost, and this is exactly the information I could have used.
I didn't know about Balsamiq, I'll definitely be trying that out on my next project.
Thanks for another awesome cast!
Using the hidden tag set to
nil
didn't work in my rails project. It might have to do with the fact that I'm using the Mongoid ODM. I found that unless all the values in the array are valid ids, nothing will change. (I suspect that ActiveRecord just ignores any non-valid values.)To combat this issue, I set my hidden tag to a string like 'included'. Then in the controller, I used the line
I'm not sure if this is the best solution, but it works.
Sorttable is ridiculously easy to use, unobtrusive, and doesn't require all those http requests.
Thanks for the suggestion!