Rails: activeadmin, undefined method `per' for #

后端 未结 8 1305
暖寄归人
暖寄归人 2021-02-02 18:15

I installed ActiveAdmin successfully:

My gemfile code:

source \'https://rubygems.org\'

 gem \'rails\', \'3.2.10\'

 # Bundle edge Rails instead:
         


        
8条回答
  •  执笔经年
    2021-02-02 18:42

    This one helped me:

     if defined?(WillPaginate)
       ActiveSupport.on_load :active_record do
         module WillPaginate
           module ActiveRecord
             module RelationMethods
               def per(value = nil) per_page(value) end
               def total_count() count end
             end
           end
           module CollectionMethods
             alias_method :num_pages, :total_pages
           end
         end
       end
     end
    

提交回复
热议问题