Class: SpeedupDashboard::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/speedup_dashboard/application_controller.rb

Direct Known Subclasses

RequestsController, ServersController

Instance Method Summary collapse

Instance Method Details

#authorize_serverObject



14
15
16
17
18
# File 'app/controllers/speedup_dashboard/application_controller.rb', line 14

def authorize_server
  unless set_server
    return render_403
  end
end

#find_optional_serverObject



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

def find_optional_server
  @server = Server.find_by(id: params[:server_id])
end

#render_403Object



10
11
12
# File 'app/controllers/speedup_dashboard/application_controller.rb', line 10

def render_403
  render_error(403)
end

#render_error(status, message = nil) ⇒ Object



4
5
6
7
8
# File 'app/controllers/speedup_dashboard/application_controller.rb', line 4

def render_error(status, message=nil)
  @message = message
  render 'speedup_dashboard/common/error', status: status
  false
end