Sha256: 6f05794e63381b4410271de6dc21eb86d7c72a21fb4b9932fa55958c0bbfb737

Contents?: true

Size: 886 Bytes

Versions: 10

Compression:

Stored size: 886 Bytes

Contents

---
redirect_from: /docs/3-index-pages/custom-index.html
---

# Custom Index

If the supplied Active Admin index components are insufficient for your project
feel free to define your own. Index classes inherit from `ActiveAdmin::Component`
and require a `build` method and an `index_name` class method.

```ruby
module ActiveAdmin
  module Views
    class IndexAsMyIdea < ActiveAdmin::Component

      def build(page_presenter, collection)
        # ...
      end

      def self.index_name
        "my_idea"
      end

    end
  end
end
```

The build method takes a PagePresenter object and collection of whatever you
choose.

The `index_name` class method takes no arguments and returns a string that should
be representative of the the class name. If this method is not defined, your
index component will not be able take advantage of Active Admin's
*multiple index pages* feature.

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
activeadmin-rb-1.6.0 docs/3-index-pages/custom-index.md
activeadmin-rb-1.5.2 docs/3-index-pages/custom-index.md
activeadmin-rb-1.5.1 docs/3-index-pages/custom-index.md
activeadmin-rb-1.5.0 docs/3-index-pages/custom-index.md
activeadmin-rb-1.4.0 docs/3-index-pages/custom-index.md
activeadmin-1.3.1 docs/3-index-pages/custom-index.md
activeadmin-1.3.0 docs/3-index-pages/custom-index.md
activeadmin-1.2.1 docs/3-index-pages/custom-index.md
activeadmin-1.2.0 docs/3-index-pages/custom-index.md
activeadmin-1.1.0 docs/3-index-pages/custom-index.md