Frage

I am using the devise gem for authentication and have the following before_filter in my ApplicationController:

  before_filter :require_login

  def require_login
    unless user_signed_in? || params[:controller] == 'devise/sessions'
      flash[:error] = "You must be logged in to access that page."
      redirect_to new_user_session_path
    end
  end

I have recently implemented the ActiveAdmin gem and am trying to get skip_before_filter to work for ActiveAdmin, so that I can access ActiveAdmin. I have attempted the methods outlined in this post, adding the following to config/initializers/active_admin.rb:

  config.skip_before_filter :require_login

and also adding the following to one of my admin model files, listing.rb:

ActiveAdmin.register Listing do

  controller do
    skip_before_filter :require_login
  end

end

but it doesn't seem to work, even after restarting the server and browser.

What am I doing wrong?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top