ActiveAdmin how to add a custom controller without a model

Possible duplicate:
Add page for active administrator

I'm currently looking for a solution to add a controller without a model for the administrator generating ActiveAdmin (and Rails 3.1). Of course, I would like to add a new menu to the navigation bar.

Use ActiveAdmin.register MyControllerWithoutModel dodoes not work.

Edit: This question is a duplicate of Add page for active admin , but no answer found.

+5
source share
2 answers

, , ViewLogger . , .

/app/models/viewlogger.rb , http://keithmcdonnell.net/activerecord_tableless_model_gem.html google .

class Viewlogger < ActiveRecord::Base

  def self.columns 
    @columns ||= []
  end

  # ...  

end

/config/initializers/inflections.rb

ActiveSupport::Inflector.inflections do |inflect|
  inflect.uncountable %w( viewlogger )
end

, config/routes.rb:

match '/admin/viewlogger' => 'admin/viewlogger#index', :as => :admin_viewlogger

activeadmin (, )

ActiveAdmin.register Viewlogger do
  config.comments = false
  before_filter do @skip_sidebar = true end
  # menu false
  config.clear_action_items!   # this will prevent the 'new button' showing up


  controller do
    def index
      # some hopefully useful code
      render 'admin/viewlogger/index', :layout => 'active_admin'
    end
  end   

+2

, , , . db .

:

config.clear_sidebar_sections!

ActiveAdmin.application.namespaces[:admin].resources['Configuration'].namespace.menu.items.each{|i| i.instance_eval('@cached_url[:admin_configurations_path] = "/admin"')}
0

All Articles