Class: Tasks::Gis::OtuDistributionDataController

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

Instance Method Summary (collapse)

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

- (Object) show

GET /tasks/gis/otu_distribution_data(/:id)(.:format)



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/tasks/gis/otu_distribution_data_controller.rb', line 5

def show
  id = params[:id]
  if id.blank?
    @otu = Otu.where(project_id: sessions_current_project_id).first
  else
    @otu = Otu.where(project_id: sessions_current_project_id).find(id)
  end

  @distribution = Distribution.new(
    otus: Otu.where(id: @otu.id).where(project_id: sessions_current_project_id).page(params[:page])
  )
  @type_tag = 'Otu'
end

- (Object) show_for_taxon_name



19
20
21
22
23
24
25
26
27
# File 'app/controllers/tasks/gis/otu_distribution_data_controller.rb', line 19

def show_for_taxon_name
  @taxon_name = TaxonName.where(project_id: sessions_current_project_id).find(params[:id])
  @distribution = Distribution.new(
    otus: Otu.for_taxon_name(@taxon_name).where(project_id: sessions_current_project_id).page(params[:page]).per(10)
  )
  @type_tag = 'Taxon name'
  
  render :show
end