Search code examples
ruby-on-railsruby-on-rails-3activerecordactiveadminbefore-filter

Active_Admin routing issue


I have installed Active_Admin gem in my app but I have a filter on my application so the only page you can get to is the log in page. When I try to access the active_admin page it routes me to my log in page of my application, not my admin log in. When I log into my application I can then access the active_admin log in page. My question is where I would put my skip_before_filter statement in this gem? Thank You.


Solution

  • You would put the skip filter in your Application Controller. This could be in a lib/my_active_admin.rb. Then require 'my_active_admin' in applications_controller before the ApplicationControllers definition.

    module ActiveAdmin
      class ResourceController < BaseController
        before_filter :my_filter
    
        protected
    
        def my_filter
          <logic here>
        end
      end
    end