Check Parameter is Integer

if params[:some_key].to_i != 0

Granted, you’ll need a separate check if the number actually can be 0, but String#to_i returns 0 when there is no number.

Jason

Jason Roelofs wrote:

if params[:some_key].to_i != 0

Granted, you'll need a separate check if the number actually can be 0, but String#to_i returns 0 when there is no number.

Depending on the OPs needs he may want to use the method Integer and rescue the ArgumentError - or just use Bills suggestion.