Codes work in console, irb, but not on website

Jason wrote:

I have the following code in my controller:

   rid = params[:route_id]
   salesorders = SalesOrder.find(:all)
   @sales_orders = []

   for so in salesorders
      if not so.latest_history.nil?
        if so.latest_history.route_id == rid
          @sales_orders << so

If I use script/console, using the integer 2 instead of the
params[:route_id], it returns 19 results into @sales_orders. When I run
it on my site, I get 0 results. What's the difference? I ran
debug(params) and it's showing params[:route_id] is begin set to 2.

Any ideas?


Probably a data type mismatch. E.g. one is a string and the other is an integer/fixnum.