![](/img/trans.png)
[英]Populate a collection for a form in a before_filter in ActiveAdmin
[英]ActiveAdmin - execute before_filter only when signed in
我只想在用戶登錄到active_admin
時運行before_filter
。 換句話說,除了執行會話操作(新建,創建,銷毀)外,請運行before_filter
。
我為active_admin
使用以下配置:
config.authentication_method = :authenticate_user!
config.before_filter :my_before_filter
問題是,即使用戶嘗試登錄,每次也會執行my_before_filter
。添加以下內容except: []
似乎無效。 任何幫助將不勝感激。
注意:它似乎按我運行bundle update
之前所述的那樣工作。 我的Gemfile中包含以下內容:
gem 'activeadmin', github: 'gregbell/active_admin'
我有與配置相同的問題。 塊似乎沒有參數
我的解決方法是
config.before_filter :try_this_out
然后
def try_this_out
if admin_user_signed_in?
logger.debug "you are here"
end
end
不是理想和干凈,但是可以。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.