I’m trying to update many active records at the same time using the :update method and they don’t seem to update fine.
@drop_ship_order_line_items = DropShipOrderLineItem.update(params[:drop_ship_order_line_items].keys, params[:drop_ship_order_line_items].values).reject { |dsoli| dsoli.errors.empty? }
params[:drop_ship_order_line_items] returns the following hash:
{“11″=>{“available”=>”1”}, “2”=>{“available”=>”1”}}
But the models don’t seem to update correctly…anyone with insides?
AFAIK you can’t update models like this on rails, you would have to do it like this:
EDIT
There’s probably an attr_protected call somewhere in your code, you should check which attributes are protected or not in there.
If you think you can safely ignore the protection on this specific call, you can use some sending do work out the magic (disclaimer: this is on your own, i’m just showing a possibility):
This is going to overcome the attribute protection, but you should make sure this is a safe call and you’re not going to burn yourself by doing this.