這讓我瘋狂。我試圖設置設計的專家和一切工作正常,直到我嘗試設置默認角色。在我的情況下,默認角色是用戶。當我嘗試登錄,我得到以下錯誤: 引發ArgumentError在設計:: SessionsController#新 應用程序/模型/ user.rb:26:在`set_default_role」 這裏是我的用戶.RB: class User < ActiveRecord::Base
en
我需要像學者繼承中的範圍繼承。想象一下scenarion: class ApplicationPolicy
class Scope
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resol
我現在的索引操作是這樣的: def index
@proposals = current_user.proposals
end
但我想這樣做是這樣的: def index
@proposals = policy_scope(Proposal)
end
我有User和Proposal之間的has_and_belongs_to關係。 我開始在我的應用程序
在具有activeadmin gem(當前主分支)的Rails 4應用程序中,我使用Pundit進行授權。它適用於資源,但我無法使其適用於網頁。 鑑於例如: ActiveAdmin.register_page "Home" do
content do
para "some text"
end
end
我怎麼會授權其針對特定用戶? 通過閱讀權威人士自述我用下面的