How do I edit or override the footer of ActiveAdmin?

activeadmin, ruby-on-rails, ruby-on-rails-4

Solution

Answer:

In your rails app, create this file: `app/admin/footer.rb`

The content would be something like:

module ActiveAdmin
  module Views
    class Footer < Component

      def build
        super :id => "footer"                                                    
        super :style => "text-align: right;"                                     

        div do                                                                   
          small "Cool footer #{Date.today.year}"                                       
        end
      end

    end
  end
end

Don't forget! restart the app/server.

Any ActiveAdmin layout component can be customized like this.

More about it:

Why does it work? This is Ruby's magic sauce. We are reopening the definition of the Footer class and changing it for our custom content.

Is it totally customizable? I don't know. This is the inheritance path:

ActiveAdmin

class Component < Arbre::Component
class Footer < Component

Arbre

class Component < Arbre::HTML::Div

This means that we can use Arbre's DSL directly.

Problem

How do I edit or override the footer of Active_Admin?

Original source