fix bug with adding/removing wanted items
This commit is contained in:
parent
85af53417b
commit
b1670b1595
1 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue