After seriously playing around with the array I was getting from Nested Sortable, I was able to make this work by using this in my controller:
def sort
# html = "Env: #{Rails.env}. "
# infor = params[:category]
params[:category].each do |id, attr|
thisCat = params[:category][id]
@category = Category.where(:_id => id).first
# html << "ID= #{id} , thisCat= #{thisCat} Name= #{@category.name} Parent= #{@category.parent_id} ; "
unless thisCat == "null"
@category.parent_id = thisCat.to_s
@category.save
end
end
# flash[:alert] = html
# flash[:error] = infor
# render nothing: true
end
You can see what I commented out after I got it to work; that's all my debugging flash statements.
Cheers!