Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
AuthenticatedSystem, FlashTruncation
Defined in:
app/controllers/application_controller.rb

Overview

Filters added to this controller apply to all controllers in the application. Likewise, all the methods added will be available for all controllers.

Direct Known Subclasses

Admin::AbilitiesController, Admin::BaitLibraries::BaitLibrarySuppliersController, Admin::BaitLibraries::BaitLibraryTypesController, Admin::BaitLibrariesController, Admin::CustomTextsController, Admin::DelayedJobsController, Admin::FacultySponsorsController, Admin::PlatePurposesController, Admin::PrimerPanelsController, Admin::ProgramsController, Admin::ProjectsController, Admin::RobotPropertiesController, Admin::RobotsController, Admin::Roles::UsersController, Admin::RolesController, Admin::StudiesController, Admin::UsersController, AdminController, AdvancedSearchController, Api::V2::Bioscan::ExportPoolXpToTractionController, Api::V2::Heron::PlatesController, Api::V2::Heron::TubeRackStatusesController, Api::V2::Heron::TubeRacksController, AssetAuditsController, AssetsController, BarcodePrintersController, Batches::CommentsController, Batches::RequestsController, BatchesController, BulkSubmissionExcel::DownloadsController, BulkSubmissionsController, DocumentsController, DriverFilesController, EventsController, GelsController, GetYourQcCompletedTubesHereController, HealthController, HomesController, LabSearchesController, Labware::CommentsController, LabwareController, LabwhereReceptionsController, LocationReportsController, MessengersController, NpgActions::AssetsController, OrdersController, ParentsController, PhiX::SpikedBuffersController, PhiX::StocksController, PhiXesController, PickListsController, PipelinesController, PlatePicksController, PlateSummariesController, PlateTemplatesController, PlatesController, PoolingsController, ProjectsController, QcFilesController, QcReportsController, QuadStampController, Receptacles::CommentsController, ReceptaclesController, ReferenceGenomesController, ReportFailsController, Requests::CommentsController, RequestsController, RobotVerificationsController, SampleLogisticsController, SampleManifestUploadWithTagSequencesController, Samples::CommentsController, Samples::StudiesController, SamplesController, Sdb::BaseController, SearchesController, SequenomQcPlatesController, SessionsController, StockStampersController, Studies::AssetGroupsController, Studies::CommentsController, Studies::DocumentsController, Studies::EventsController, Studies::InformationController, Studies::SamplesController, StudiesController, StudyReportsController, SubmissionsController, TagGroupsController, TagLayoutTemplatesController, TagSetsController, TagSubstitutionsController, TubeRackStatusesController, TubeRackSummariesController, UatActionsController, UsersController, UuidsController, WorkflowsController

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#block_api_access(message = nil, format = :xml) ⇒ Object



28
29
30
31
32
# File 'app/controllers/application_controller.rb', line 28

def block_api_access(message = nil, format = :xml)
  content = { error: 'Unsupported API access' }
  content[:message] = message unless message.nil?
  { format => content.send(:"to_#{format}", root: :errors), :status => 406 }
end

#evil_parameter_hack!Object



45
46
47
48
49
50
51
# File 'app/controllers/application_controller.rb', line 45

def evil_parameter_hack!
  # WARNING! This hack is purely in place while we manually update ALL our
  # existing controllers to support Strong Parameters. It should under
  # not circumstances get used in new code, and should be removed from
  # existing controllers as soon as humanly possible.
  params.permit!
end

#extract_header_infoObject



34
35
36
37
# File 'app/controllers/application_controller.rb', line 34

def extract_header_info
  exclude_nested_resource = request.headers['HTTP_EXCLUDE_NESTED_RESOURCE'] || params[:exclude_nested_resource]
  @exclude_nested_resource = exclude_nested_resource && exclude_nested_resource.to_s.casecmp('true').zero?
end

#set_cache_disabled!Object



39
40
41
42
43
# File 'app/controllers/application_controller.rb', line 39

def set_cache_disabled!
  response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
  response.headers['Pragma'] = 'no-cache'
  response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'
end