Answer the question
In order to leave comments, you need to log in
How to display show immediately in Active Admin, without indexa?
I use ACTIVE ADMIN.
I created a model that has only a name and mail, when you go to active admin, this page is displayed on this model.
I need the View to be displayed immediately, i.e. when you click on the link to the model, it was immediately displayed like this:
How can this be done?
Answer the question
In order to leave comments, you need to log in
In fact, you just need to redefine the index action in the desired model. Suppose you have a model called Post. If you used the default setting for active admin your code might look like this. In the file "admin/post.rb":
ActiveAdmin.register Post do
controller do
def index
::Post.count < 1 ? redirect_to(new_admin_post_path) : redirect_to(admin_post_path(::Post.first.id))
end
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question