Class: Tasks::Accessions::Report::DwcController

Inherits:
ApplicationController
  • Object
show all
Includes:
TaskControllerConfiguration
Defined in:
app/controllers/tasks/accessions/report/dwc_controller.rb

Instance Method Summary (collapse)

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

- (Object) download



12
13
14
15
16
17
18
19
20
# File 'app/controllers/tasks/accessions/report/dwc_controller.rb', line 12

def download
  # If failing remove begin/ensure/end to report Raised errors
  begin
    data = Dwca::Packer::Data.new(DwcOccurrence.where(project_id: sessions_current_project_id))
    send_data(data.getzip, :type => 'application/zip', filename: data.filename)
  ensure
    data.cleanup
  end
end

- (Object) index



4
5
6
# File 'app/controllers/tasks/accessions/report/dwc_controller.rb', line 4

def index 
  @collection_objects = CollectionObject.order(:id).includes(:dwc_occurrence).with_project_id(sessions_current_project_id).page(params[:page])
end

- (Object) row



8
9
10
# File 'app/controllers/tasks/accessions/report/dwc_controller.rb', line 8

def row
  @dwc_occurrence = CollectionObject.includes(:dwc_occurrence).find(params[:id]).get_dwc_occurrence # find or compute for
end