If else statement problem

p will be either 1 or 2 depending on the value of params[:position] from the form.

actually params[:position] will be the string '1' or the string '2', however you're comparing it to integers, hence you fall through to the else statement.

fred