When a radio button is checked, the whole form is submitted. The answers_controller (below) does update the result, so everything works, but i get the aforementioned error in the console. I realize that in my update_result.js.erb (below) nothing is assigned to the @answers variable but i have been unable to make adjustments to it for the way i am passing the values.
answers_controller:
def update_result
params[:answer].each_pair do |key,value|
@ans = Answer.find(key.to_i)
@ans.update_attributes(:score => value)
end
end
update_result.js.erb:
$("#answers").html("<%=escape_javascript(render(@answers)) %>");
Thanks!