I have an update function that I have written inside of one of my php activerecord models. For some reason it is causing the foreach loop to send back invalid argument supplied for foreach
public static function set_price($prices)
{
foreach ($prices as $key => $value)
{
$item = Quote_Item::find($key);
$stuff = $item->update_attribute('price', $value);
}
}
I have verified that prices is an array and that the item is being found correctly. I have checked enough things to know that this line is causing the problem $stuff = $item->update_attribute('price', $value); I don't really see how it can affect a foreach loop?