Class: Compass::ApplicationController

Inherits:
ActionController::API
  • Object
show all
Defined in:
app/controllers/compass/application_controller.rb

Overview

Base compass controller.

Instance Method Summary collapse

Instance Method Details

#authenticateObject



12
13
14
# File 'app/controllers/compass/application_controller.rb', line 12

def authenticate
  head(:forbidden) unless instance_exec(&Compass.config.authenticate)
end

#context_modified_atObject



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

def context_modified_at
  instance_exec(&Compass.config.modified_at)
end

#current_contextObject



20
21
22
# File 'app/controllers/compass/application_controller.rb', line 20

def current_context
  instance_exec(&Compass.config.context)
end

#current_context_idObject



24
25
26
# File 'app/controllers/compass/application_controller.rb', line 24

def current_context_id
  instance_exec(&Compass.config.context_id)
end

#set_cache_headers(config) ⇒ Object



32
33
34
35
36
37
38
# File 'app/controllers/compass/application_controller.rb', line 32

def set_cache_headers(config)
  if config
    expires_in(*Array(config))
  else
    expires_now
  end
end

#validate_contextObject



16
17
18
# File 'app/controllers/compass/application_controller.rb', line 16

def validate_context
  head(:bad_request) unless current_context_id.to_s.eql?(params[:context_id])
end