I have the following code in my controller: if request.post? 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 end end end end 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? Thanks!
on 2007-04-05 23:00
on 2007-04-06 07:07
Jason wrote: > @sales_orders << so > Any ideas? > > Thanks! Probably a data type mismatch. E.g. one is a string and the other is an integer/fixnum. -- Michael Wang
on 2007-04-10 16:10
You were right. I had to do the following to get it to work: params[:route_id].to_i Thanks!