You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
719 B

8 years ago
7 years ago
7 years ago
8 years ago
  1. class ApplicationController < ActionController::Base
  2. # Prevent CSRF attacks by raising an exception.
  3. # For APIs, you may want to use :null_session instead.
  4. protect_from_forgery with: :exception
  5. force_ssl if: "Rails.env.production? && ENV['LOCAL_HTTPS'] == 'true'"
  6. helper_method :current_account
  7. rescue_from ActionController::RoutingError, with: :not_found
  8. rescue_from ActiveRecord::RecordNotFound, with: :not_found
  9. def raise_not_found
  10. raise ActionController::RoutingError.new("No route matches #{params[:unmatched_route]}")
  11. end
  12. protected
  13. def not_found
  14. respond_to do |format|
  15. format.any { head 404 }
  16. end
  17. end
  18. def current_account
  19. current_user.try(:account)
  20. end
  21. end