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,12 +29,12 @@ class TalkPreferencesController < ApplicationController
@talk_preference.transaction do @talk_preference.transaction do
@talk_preference.selected_talks.destroy_all @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: { render json: {
update_url: talk_preference_url(@talk_preference), update_url: talk_preference_url(@talk_preference),
hashed_uid: @talk_preference.hashed_unique_id, hashed_uid: @talk_preference.hashed_unique_id,
uid: @talk_preference.id uid: @talk_preference.id
} }
else else
head :unprocessable_entity head :unprocessable_entity
raise ActiveRecord::Rollback raise ActiveRecord::Rollback