I am making a survey app with possible answers between 1 -5 agree/disagree.
If the user submits the form and has not answered all questions I redirect them back, and am trying to set the correct radio button as checked so they do not lose their existing answers.
i.e if for question 5 they selected 4 as their answer, then I want to set its value to 4.
The problem is the code below is not setting checked='checked' when it should.
input id="#{ question.id }-5" name=question.id type='radio' value='5' checked=(params[question.id.to_i.to_s.to_sym] == 5?'checked':false)