spree/spree — pull request #1394 by iloveitaly (2012-04-13 14:16:11+00:00)
Title: Add multiple products

According to [the docs](https://github.com/spree/spree/blob/master/core/app/controllers/spree/orders_controller.rb#L44) I should be able to do something like:

```
{
"utf8"=>"✓", "authenticity_token"=>"Zm6SDMn/pKG+yLOiHoSHUqi8eIw078Zw9WeLroZ5hZY=",
"products"=>{"353"=>"375", "354"=>"376", "355"=>"377"},
"quantity"=>{"375"=>"2", "376"=>"1", "377"=>"1"},
"action"=>"populate",
"controller"=>"spree/orders"
}
```

And multiple products should be added to the shopping cart. However the `params[:quantity][variant_id.to_i]` in the above referenced `orders#popular` evaluates to `nil` because the keys in params[:quantity] are strings. I'm pretty new to rails, but I haven't found a way to force POST / GET params to be converted to a specific type.

Removing the `to_i` fixes the issue for me.

Am I missing an obvious solution here?

Thanks