Sha256: 014efc7d460a88bf6da53cd24d3b4989fb28cbcdd4b9db10817b5d0d4124aeb3
Contents?: true
Size: 777 Bytes
Versions: 2
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true module RailsMiniProfiler class ApplicationController < ::ApplicationController rescue_from ActiveRecord::RecordNotFound, with: :not_found before_action :check_current_user protected def present(model, presenter_class = nil, **kwargs) klass = presenter_class || "RailsMiniProfiler::#{model.class.to_s.demodulize}Presenter".constantize presenter = klass.new(model, view_context, **kwargs) yield(presenter) if block_given? presenter end private def not_found(error) redirect_back(fallback_location: profiled_requests_path, alert: error.to_s) end def check_current_user redirect_back(fallback_location: root_path) unless User.get(request.env).present? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_mini_profiler-0.1.1 | app/controllers/rails_mini_profiler/application_controller.rb |
rails_mini_profiler-0.1.0 | app/controllers/rails_mini_profiler/application_controller.rb |