Configurando rotas para API Rails

Set default routes.rb LearningApi::Application.routes.draw do…end Isole o controlador da API no namespace, crie a pasta da API em app / controladores mkdir app/controllers/api Adicione namespace a routes.rb LearningApi::Application.routes.draw do namespace …

Continuar lendo

Rotas personalizadas ActiveAdmin

# admin/posts.rbActiveAdmin.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 endend# routes.rbRails.application.routes.draw do get ‘/admin/posts/first_page’, to: ‘admin/posts#first_page’, as: :admin_posts_first_page ActiveAdmin.routes(self)end

Continuar lendo