Q:

Rails 4 ActiveAdmin - undefined local variable or method `collection_before_scope'

I have a strange problem with my ActiveAdmin resource:
ActiveAdmin.register ServicePage do
  menu priority: 5

  permit_params :title, :body, :slug, :published

  config.sort_order = 'created_at_desc'
  config.per_page = 10

  scope :all, default: true
  scope :published
  scope :not_published

  filter :title
  filter :slug
end

When I try to access index page for it, I get undefined local variable or method 'collection_before_scope' for #<ActiveAdmin::Views::Scopes:0x007f4c8ecdfa28> error.
When I remove those 3 scope's, I get Collection is not a paginated scope. Set collection.page(params[:page]).per(10) before calling :paginated_collection.
But if only I change code to ActiveAdmin.register ServicePage, as: 'page' do, all seems to become ok. I am sure, that when I've just added ServicePage resource to ActiveAdmin, it worked. Can someone tell me, what's going on?
(Ruby 2.1.2, Rails 4.1.6, active_admin 1.0.0.pre)

A:

The problem was in my ApplicationController, in this code:
class ApplicationController < ActionController::Base
  before_action :set_service_pages

  # ...

  def set_service_pages
    @service_pages = ServicePage.published
  end
end

If I change the @service_pages variable name, all starts to work again. So the solution for me was to add
controller do
  skip_before_filter :set_service_pages
end

in my ActiveAdmin's ServicePage resource.
By the way, why does ActiveAdmin even care about my variable names?

