Class: Tasks::CollectingEvents::BrowseController

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

Instance Method Summary collapse

Methods included from TaskControllerConfiguration

#set_is_task_controller

Instance Method Details

#assign_collecting_eventObject (protected)


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

def assign_collecting_event
  @collecting_event = CollectingEvent.where(project_id: sessions_current_project_id, id: params[:collecting_event_id]).first

  if !@collecting_event && params[:collection_object_id]
    @collecting_event = CollectionObject.where(project_id: sessions_current_project_id, id: params[:collection_object_id]).first&.collecting_event
  end

  @collecting_event ||= CollectingEvent.where(project_id: sessions_current_project_id).first
end

#indexObject

GET /tasks/collecting_events/browse<?collecting_event_id=123>


5
6
7
8
# File 'app/controllers/tasks/collecting_events/browse_controller.rb', line 5

def index
  assign_collecting_event
  redirect_to new_collecting_event_path, notice: 'Create a collecting event first.' and return if @collecting_event.nil?
end