1
0
Fork 0
forked from OpenNeo/impress

fix bug with adding/removing wanted items

This commit is contained in:
Emi Matchu 2011-07-22 16:17:13 -04:00
parent 85af53417b
commit b1670b1595

View file

@ -28,7 +28,12 @@ class ClosetHangersController < ApplicationController
# expectations, though, and I can't really think of a genuinely RESTful way
# to pull this off.
def update
owned = (params[:closet_hanger][:owned] == 'true') if params[:closet_hanger]
if params[:closet_hanger]
owned = case params[:closet_hanger][:owned]
when 'true' then true
when 'false' then false
end
end
owned ||= true
@closet_hanger = current_user.closet_hangers.find_or_initialize_by_item_id_and_owned(@item.id, owned)