Fix bug when no talks are selected

This commit is contained in:
Petko Bordjukov 2017-09-28 15:37:31 +03:00
parent fc817e78b0
commit 579fd2c04f
1 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ class TalkPreferencesController < ApplicationController
@talk_preference.transaction do
@talk_preference.selected_talks.destroy_all
if @talk_preference.update talk_preference_params
if params[:talk_preference].blank? || @talk_preference.update(talk_preference_params)
render json: {
update_url: talk_preference_url(@talk_preference),
hashed_uid: @talk_preference.hashed_unique_id,