Undefined method “reorder” for # using ActiveAdmin

前端 未结 3 1730
南笙
南笙 2020-12-19 02:25

I have a problem with ActiveAdmin using Ruby ruby 1.9.2p290 and Ruby on Rails 3.2.1.

I used this wiki page to setup the resource for the AdminUsers that works perfec

3条回答
  •  無奈伤痛
    2020-12-19 03:16

    Ah, I've found the solution. I don't know exactly why the error happened but I had to change my application_controller.

    In the application_controller I fetched all projects to @projects:

    before_filter :getActiveProjects
    
    protected
    
      def getActiveProjects
        @projects = Project.isactive.find(:all, :order => 'LOWER(name) asc')
      end
    

    That was confusing ActiveAdmin. After I changed that to

    before_filter :getActiveProjects
    
    protected
    
      def getActiveProjects
        @projects_all = Project.isactive.find(:all, :order => 'LOWER(name) asc')
      end
    

    and projects_controller index action to

    def index
      @projects = @projects_all
    end
    

    everything worked fine ;)

提交回复
热议问题