diff --git a/app/controllers/measurements_controller.rb b/app/controllers/measurements_controller.rb index da7d27a..d26ba53 100644 --- a/app/controllers/measurements_controller.rb +++ b/app/controllers/measurements_controller.rb @@ -42,8 +42,6 @@ class MeasurementsController < ApplicationController if @measurement.destroy flash[:notice] = 'Deleted measurement' end - prepare_measurements - render :index end def retake diff --git a/app/views/measurements/destroy.js.erb b/app/views/measurements/destroy.js.erb new file mode 100644 index 0000000..c82772a --- /dev/null +++ b/app/views/measurements/destroy.js.erb @@ -0,0 +1,5 @@ +$('div[id^=flash_]').remove(); +$('#content').prepend('<%= j render_flash_messages %>'); +<% if @measurement.destroyed? %> + $('tr[id=measurement-<%= @measurement.id %>]').remove(); +<% end %>