Blob of app/controllers/application.rb (raw blob data)

1 # Filters added to this controller apply to all controllers in the application.
2 # Likewise, all the methods added will be available for all controllers.
3
4 class ApplicationController < ActionController::Base
5 session :session_key => '_ks1_session_id', :secret => GitoriousConfig["cookie_secret"]
6 include AuthenticatedSystem
7 include ExceptionNotifiable
8
9 rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
10
11 protected
12 def require_user_has_ssh_keys
13 unless current_user.ssh_keys.count > 0
14 flash[:error] = "You need to upload your public key first"
15 redirect_to new_account_key_path
16 return
17 end
18 end
19
20 def find_project
21 @project = Project.find_by_slug!(params[:project_id])
22 end
23
24 def render_not_found
25 render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
26 end
27 end