freemanoid
freemanoid

Reputation: 14770

Custom action brokes the routes

I want to add a custom action.

  config.actions do
    member :change_status do
      register_instance_option :link_icon do
        'icon-check'
      end
    end
  end

But when I restart the server, there is no rails_admin routes. I can't see it in rake routes as well.

ActionController::RoutingError (No route matches [GET] "/admin/user"):



Routes for RailsAdmin::Engine:
  bulk_action POST /:model_name/bulk_action(.:format)       rails_admin/main#bulk_action
change_status GET  /:model_name/:id/change_status(.:format) rails_admin/main#change_status

rails_admin 0.6.2

Upvotes: 0

Views: 104

Answers (1)

freemanoid
freemanoid

Reputation: 14770

As we can see here https://github.com/sferik/rails_admin/wiki/Actions

RailsAdmin.config do |config|
  config.actions do
    dashboard                     # mandatory
    index                         # mandatory
  end
end

We need to explicitly define dashboard and index actions in case of adding actions block to the rails_admin config file.

Upvotes: 1

Related Questions