renderメソッドのstatusというオプションを使用。
render status: 401
今回の実装
class AdminController < ApplicationController def admin if current_user.admin = true render "admin" else render file: "#{Rails.root}/public/404.html", status: 401 end end end
renderメソッドのstatusというオプションを使用。
render status: 401
class AdminController < ApplicationController def admin if current_user.admin = true render "admin" else render file: "#{Rails.root}/public/404.html", status: 401 end end end