Rails 3.2 Activeadmin 'Collection Is Not a Paginated Scope.' Error

Active Admin Scope with rails 4.1

You should define your scope using a proc.

class ClassList < ActiveRecord::Base
scope :upcoming_classes, proc { where('class_date > ?', Date.today) }
end

Rails 4+ expects scopes to be wrapped with a callable object, which is usually defined as a proc. See the Active Record Query Interface: Scopes documentation; there they use the -> { } proc syntax.

Active Admin: can't scope the resource to current_admin_user

I found the better solution, then.

Authorization adapter do just fine, and there is not need for scopes. For example, with CanCan:

class Ability
include CanCan::Ability

def initialize(user)

#read/manage actions
if user.role == 'manager'
can :manage, Payment, :accessible_by_manager => true

elsif user.role == 'accountant'
can :read, Payment, :accessible_by_accountant => true
else
#can read all
can :read, Payment
end
end

end

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

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?

ActiveAdmin 0.4.3 Rails 3.2.3 Upgrade Error

Try this in your config block:

ActiveAdmin.setup do | config | 
...
config.logout_link_path = :signout_path
...
end

Cheers.



Related Topics



Leave a reply



Submit