Displaying 1 result from an estimated 1 matches for "item_array".
2008 Apr 29
10
Better way to remove value from list??
...example.
This code works, but I don''t think that it''s efficient. It''s all in my
controller. I''d be happy to move things around too. Any help on how to
do this much better would be appreciated.
@order = Order.find(params[:id])
@remove_item = params[:item]
@item_array = @order.item_codes.split(/,\s*/)
@item_array.delete(@remove_item)
@item_string = @fc_array.join(",")
@order.item_codes = nil
@order.item_codes = @fc_string
@order.save
THANKS!!!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You receiv...