Class: Tasks::Sources::GnfinderController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tasks::Sources::GnfinderController
- Includes:
- TaskControllerConfiguration
- Defined in:
- app/controllers/tasks/sources/gnfinder_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /tasks/sources/gnfinder.
- #set_object ⇒ Object private
Methods included from TaskControllerConfiguration
Instance Method Details
#index ⇒ Object
GET /tasks/sources/gnfinder
7 8 9 10 11 |
# File 'app/controllers/tasks/sources/gnfinder_controller.rb', line 7 def index @result = Vendor::Gnfinder.result( @document.pdftotext, project_id: [sessions_current_project_id]) end |
#set_object ⇒ Object (private)
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/tasks/sources/gnfinder_controller.rb', line 15 def set_object source_query = Source.joins(:documents, :project_sources) .where(project_sources: {project_id: sessions_current_project_id}) if @document = Document.where(project_id: sessions_current_project_id).find_by(id: params[:document_id]) @source = source_query.where(documents: {id: @document.id}).first elsif @source = source_query.find_by(id: params[:source_id]) @document = @source.documents.first else redirect_to source_hub_task_path, notice: 'Source without Document or Document not found.' and return end end |