2014-02-20 83 views
0

我想僅在用戶登錄active_admin時才運行before_filter。換句話說,運行before_filter,除非執行會話操作(新建,創建,銷燬)。ActiveAdmin - 僅在登錄時執行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' 

回答

1

我和配置有同樣的問題。塊似乎沒有采取PARAMS

我的解決方法是

config.before_filter :try_this_out 

然後

def try_this_out 
    if admin_user_signed_in? 
    logger.debug "you are here" 
    end 
end 

不理想幹淨的,但它的作品。

+1

我不希望''before_filter'在用戶註銷時執行,在這種情況下,它會是。我希望它每次都運行,除非用戶登錄和註銷。 –