Last active
August 29, 2015 14:03
-
-
Save adyrcz/d5db81ade1fefb769189 to your computer and use it in GitHub Desktop.
Auditcontroller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuditsController < ApplicationController | |
before_action :authenticate_user!, except: [:index, :show] | |
before_action :correct_user, only: [:edit, :update, :destroy] | |
before_action :set_audit, only: [:show, :edit, :update, :destroy] | |
. | |
. | |
. | |
. | |
. | |
. | |
def correct_user | |
@audit = current_user.audit.find_by(id: params[:id]) | |
redirect_to audits_path, notice: "Not authorized to edit this Test" if @audit.nil? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment