[フレーム]
Last Updated: July 25, 2019
·
5.965K
· sadfuzzy

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

AltStyle によって変換されたページ (->オリジナル) /