Fix bug when no talks are selected
This commit is contained in:
parent
fc817e78b0
commit
579fd2c04f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue