app/controllers/users_controller.rb
# Allow users to see their own profile but prevent them from viewing others.
Allow users to see their own profile but prevent them from viewing others.
Allow users to see their own profile but prevent them from viewing others .
def authorize_user
    if @user.present?
      authorize @user
    else
      authorize_users
    end
  end
def authorize_user if @user . present? authorize @user else authorize_users end end
Allow users to see their own profile but prevent them from viewing others.
Allow users to see their own profile but prevent them from viewing others .
# Pass the object @user to Pundit to check against @current_user