Class: MissingText::DiffController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MissingText::DiffController
- Defined in:
- app/controllers/missing_text/diff_controller.rb
Instance Method Summary collapse
Instance Method Details
#clear_history ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/missing_text/diff_controller.rb', line 30 def clear_history MissingText::Batch.delete_all MissingText::Record.delete_all MissingText::Entry.delete_all MissingText::Warning.delete_all redirect_to root_path end |
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/missing_text/diff_controller.rb', line 7 def index # if no batch is specified, just load the last batch # this will ensure that we don't get any nil errors @batch = MissingText::Batch.try(:find_by_id, params[:id]) unless @batch.present? @batch = MissingText::Batch.last end # only load the diff information if a batch is found if @batch.present? @records = MissingText::Record.where(missing_text_batch_id: @batch.id) @entries = MissingText::Entry.where("missing_text_records_id in (?)", @records.pluck(:id)) @warnings = MissingText::Warning.where(missing_text_batch_id: @batch.id) end end |
#rerun ⇒ Object
25 26 27 28 |
# File 'app/controllers/missing_text/diff_controller.rb', line 25 def rerun MissingText::Runner.run redirect_to root_path end |