Improve Error messages

- Improve error messages in event schedules, schedules and program controller.
- Two respond_to blocks in the update method of program controller.
This commit is contained in:
Ana 2016-08-08 18:29:31 +02:00
parent c687c1072e
commit e8261d41bc
4 changed files with 13 additions and 11 deletions

View file

@ -6,7 +6,7 @@ module Admin
if @event_schedule.save
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => "The event couldn't be scheduled" }
render json: { 'status' => "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }
end
end
@ -14,7 +14,7 @@ module Admin
if @event_schedule.update(event_schedule_params)
render json: { 'status' => 'ok', event_schedule_id: @event_schedule.id }
else
render json: { 'status' => "The event couldn't be scheduled" }
render json: { 'status' => "The event couldn't be scheduled. #{@event_schedule.errors.full_messages.join('. ')}" }
end
end
@ -22,7 +22,7 @@ module Admin
if @event_schedule.destroy
render json: { 'status' => 'ok' }
else
render json: { 'status' => "The event couldn't be unscheduled" }
render json: { 'status' => "The event couldn't be unscheduled. #{@event_schedule.errors.full_messages.join('. ')}" }
end
end