app/controllers/staffs/accounts_controller.rb
# frozen_string_literal: true
class Staffs::AccountsController < ApplicationController
include PaginalController
before_action :set_account, except: :index
# GET /staff/accounts
def index
authorize [:staff, Account]
@accounts = policy_scope(
Account,
policy_scope_class: Staff::AccountPolicy::Scope,
).page(active_page)
end
# GET /staff/accounts/:nickname
def show
authorize [:staff, @account]
end
private
def set_account
@account = Account.find_by! nickname: params[:nickname]
end
end