Class: Tasks::CollectionObjects::BrowseController

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

Instance Method Summary (collapse)

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

- (Object) index

GET



7
8
9
# File 'app/controllers/tasks/collection_objects/browse_controller.rb', line 7

def index
  @data = CollectionObjectCatalog.data_for(@collection_object)
end

- (Object) set_collection_object (protected)



13
14
15
16
17
18
# File 'app/controllers/tasks/collection_objects/browse_controller.rb', line 13

def set_collection_object
  id = params[:id]
  id ||= CollectionObject.with_project_id(sessions_current_project_id).limit(1).pluck(:id)[0]
  redirect_to new_collection_object_path, notice: 'Create a collection object first.' and return if id.nil? 
  @collection_object = CollectionObject.with_project_id(sessions_current_project_id).includes(:identifiers, :collecting_event, depictions: [:image], taxon_determinations: [:determiners]).find(id)
end