Class: Tasks::TaxonNames::MergeController

Inherits:
ApplicationController
  • Object
show all
Includes:
TaskControllerConfiguration
Defined in:
app/controllers/tasks/taxon_names/merge_controller.rb

Instance Method Summary collapse

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

#indexObject

GET



5
6
# File 'app/controllers/tasks/taxon_names/merge_controller.rb', line 5

def index
end

#mergeObject

POST



15
16
17
18
19
20
21
# File 'app/controllers/tasks/taxon_names/merge_controller.rb', line 15

def merge
  @from_taxon_name = TaxonName.where(project_id: sessions_current_project_id).find(params.require(:from_taxon_name_id))
  @to_taxon_name = TaxonName.where(project_id: sessions_current_project_id).find(params.require(:to_taxon_name_id))
  @result = @from_taxon_name.merge_to(@to_taxon_name, params.require(:kind).to_sym)

  render 'report', status: :ok and return
end

#reportObject

GET



9
10
11
12
# File 'app/controllers/tasks/taxon_names/merge_controller.rb', line 9

def report
  @from_taxon_name = TaxonName.where(project_id: sessions_current_project_id, id: params[:from_taxon_name_id]).first
  @to_taxon_name = TaxonName.where(project_id: sessions_current_project_id, id: params[:to_taxon_name_id]).first
end