简体   繁体   中英

How to exclude engine routes from rake routes

I have an engine (Social Stream) mounted into my Rails app. When I run rake routes I get all the routes, including the mounted engine's routes. This is useful, but there are many routes.

Is there a way to run rake routes so it returns the routes for the parent application only and not the engine? I would still want to be able to run for the engine as well.

I always found the output of rake routes too verbose. I usually just grep for what I'm interested in. Say I'm looking for a route that contains the word login, just run:

rake routes | grep login

Of course this goes the other way as well. Want every route except the ones containing login? Just run an inverse selection:

rake routes | grep -v login

So in your case just do an inverse selection of the engine's name.

您还可以在调用时使“耙式路由”仅显示特定控制器的路由(作为“主页”控制器的示例)

CONTROLLER=homepage rake routes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM