ActiveAdmin custom routes
# admin/posts.rb
ActiveAdmin.register Post do
controller do
def first_page
if current_admin_user.is_partner? && !current_admin_user.company
redirect_to :new_admin_post
else
redirect_to :admin_posts
end
end
end
end
# routes.rb
Rails.application.routes.draw do
get '/admin/posts/first_page', to: 'admin/posts#first_page', as: :admin_posts_first_page
ActiveAdmin.routes(self)
end
Written by Denis Savitskiy
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Activeadmin
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#