Test if a string is an integer with Ruby
<% if params[:page].is_a?(Integer) %> Nice <% else %> $#%@ <% end %>
in irb
12.is_a?(Integer) => true
codes a lot
If the code is inexplicably missing from some of my posts it is because gist.github.com is down at the moment. Check back a little later.
<% if params[:page].is_a?(Integer) %> Nice <% else %> $#%@ <% end %>
in irb
12.is_a?(Integer) => true