In my .erb file, I have the following jQuery call:
$.get(url, { point: pointValue, chore: investigate });
Both point and chore are integers.
In my .rb file, I have the following statement:
get '/estimate/:id' do
print params[:chore] # for debugging
if params[:chore] == 1
print "true!"
end
end
When I print params[:chore], the correct value is printed out in my console, either 0 or 1.
However, even in the cases when it is 1, the if block does not execute, i.e. "true!" is not printed to the console.
I am completely stumped and confused! Any ideas?
the number
1belongs to theFixnumclass. yourchorevalue does probably not. convert it to an integer before comparing (if params[:chore].to_i == 1) or inspect thechoreparams key (puts params[:chore].class).