SpeciesFileGroup/taxonworks

View on GitHub
app/controllers/concerns/data_controller_configuration/project_data_controller_configuration.rb

Summary

Maintainability
A
0 mins
Test Coverage
module DataControllerConfiguration::ProjectDataControllerConfiguration 
  extend ActiveSupport::Concern

  included do
    include DataControllerConfiguration
    before_action :require_sign_in_and_project_selection
  end

  # @return [ Arel::Nodes, :unprocessable_entity ]
  #   wrap the the params gathering, if no valid params
  #   are provided return as unprocessable
  def annotator_params(params, klass)
    w = Queries::Annotator.annotator_params(params, klass)
    if w.nil?
      respond_to do |format|
        format.html { render plain: '404 Not Found', status: :unprocessable_entity and return }
        format.json { render json: {success: false}, status: :unprocessable_entity and return }
      end
    else
      w
    end
  end

end