Sha256: 1de314274471024ed95e119efbd2303453ee72f96aec6a04548786ffbcf1bd13
Contents?: true
Size: 895 Bytes
Versions: 4
Compression:
Stored size: 895 Bytes
Contents
class Manage::ApplicationController < ApplicationController before_action :logged_in before_action :limit_admin_access, only: ["edit", "update", "new", "create", "destroy", "convert_to_admin", "deliver", "merge", "perform_merge", "toggle_bus_captain", "duplicate", "update_acc_status", "send_update_email", "live_preview"] skip_before_action :verify_authenticity_token, if: :json_request? def logged_in authenticate_user! return redirect_to root_path unless current_user.try(:admin?) end def limit_admin_access redirect_to url_for(controller: controller_name, action: :index) if current_user.admin_limited_access end def json_request? request.format.json? end def response_view_or_errors(view, model) respond_to do |format| format.html { render(view) } format.json { render json: { errors: model.errors.full_messages } } end end end
Version data entries
4 entries across 4 versions & 1 rubygems