ユーザーには、スーパー ユーザー > 管理者 > その他のユーザーという階層化されたロール モデルがあります。(私はこれを実装するために cancan を使用しています) スーパー ユーザーは他のすべてのユーザーのプロファイルにアクセスできる必要がありますが、管理者は自分が作成したユーザーのユーザー プロファイルのみにアクセスできる必要があります。投稿やコメントのように、作成したユーザーの所有権を割り当てることはできますか? 現在、私の能力ファイルは次のようになっています。
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.status == "Super User"
can :manage, :all
elsif user.status == "Admin"
can :create, User
can :show, User, :id => user.id
can :update, User, :id => user.id
end