Coder Social home page Coder Social logo

routes-query's Introduction

Routes Query

Provides a rake task to query Rails routes easier.

Install

Just download the rake task file and move it to lib/tasks/.

or:

curl https://github.com/ayamomiji/routes-query/raw/master/routes-query.rake > lib/tasks/routes-query.rake

Example

Given a routes.rb like this:

resource :profile

resources :boards do
  resources :posts do
    get :search, :on => :collection

    resources :comments
  end
end

resources :announces do
  resources :comments
end

root :to => 'main#index'

When I run rake routes:query Q=com (or rake rq Q=com)

Then it responds these:

    board_post_comments GET    /boards/:board_id/posts/:post_id/comments(.:format)          C: comments, A: index
    board_post_comments POST   /boards/:board_id/posts/:post_id/comments(.:format)          C: comments, A: create
 new_board_post_comment GET    /boards/:board_id/posts/:post_id/comments/new(.:format)      C: comments, A: new
edit_board_post_comment GET    /boards/:board_id/posts/:post_id/comments/:id/edit(.:format) C: comments, A: edit
     board_post_comment GET    /boards/:board_id/posts/:post_id/comments/:id(.:format)      C: comments, A: show
     board_post_comment PUT    /boards/:board_id/posts/:post_id/comments/:id(.:format)      C: comments, A: update
     board_post_comment DELETE /boards/:board_id/posts/:post_id/comments/:id(.:format)      C: comments, A: destroy
      announce_comments GET    /announces/:announce_id/comments(.:format)                   C: comments, A: index
      announce_comments POST   /announces/:announce_id/comments(.:format)                   C: comments, A: create
   new_announce_comment GET    /announces/:announce_id/comments/new(.:format)               C: comments, A: new
  edit_announce_comment GET    /announces/:announce_id/comments/:id/edit(.:format)          C: comments, A: edit
       announce_comment GET    /announces/:announce_id/comments/:id(.:format)               C: comments, A: show
       announce_comment PUT    /announces/:announce_id/comments/:id(.:format)               C: comments, A: update
       announce_comment DELETE /announces/:announce_id/comments/:id(.:format)               C: comments, A: destroy

When I run rake routes:query C=p A=c

Then it responds these:

           profile POST /profile(.:format)                       C: profiles, A: create
search_board_posts GET  /boards/:board_id/posts/search(.:format) C: posts, A: search
       board_posts POST /boards/:board_id/posts(.:format)        C: posts, A: create

Then it responds these:

You can use Q for match anything, C for match controllers, A for match actions, P for match paths, N for match names (helpers),

routes-query's People

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.