Sha256: bd05a456d6e697f58a2101bf8623d87d0d6abb7df9d2eda3908f8501ca0bc56c

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 Bytes

Contents

require 'active_admin'
require 'active_admin/ajax_filter/engine'
require 'active_admin/ajax_filter/version'
require 'active_admin/inputs/ajax_core'
require 'active_admin/inputs/ajax_select_input'
require 'active_admin/inputs/filters/ajax_select_input'

module ActiveAdmin
  module AjaxFilter
    class << self
      # @param [ActiveAdmin::DSL] dsl
      # @return [void]
      #
      def included(dsl)
        dsl.instance_eval do
          collection_action :filter, method: :get do
            scope = collection.ransack(params[:q]).result

            render text: scope.order(params[:order]).limit(params[:limit] || 10).to_json
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activeadmin-ajax_filter-0.3.4 lib/active_admin/ajax_filter.rb
activeadmin-ajax_filter-0.3.3 lib/active_admin/ajax_filter.rb
activeadmin-ajax_filter-0.3.2 lib/active_admin/ajax_filter.rb
activeadmin-ajax_filter-0.3.1 lib/active_admin/ajax_filter.rb