Releases: vitoravelino/modular_routes
0.3.0
-
root
helper will raise a syntax error indicating that it should be used outside ofmodular_routes
block. -
concern
andconcerns
support:modular_routes do concern :commentable do resource :comments end concern :activatable do member do put :activate put :deactivate end end resources :articles, concerns: :activatable do concerns :commentable end end
0.2.0
REMOVED
modular_route
helper was removed due to lack of syntax flexibility and a bit of inline verbosity.
NEW
-
modular_routes
helper was added to fix the problems encountered on the previous helper. Check the example below:modular_routes do resources :books get :about, to: "about#index" end
The idea was to bring simplicity and proximity to what you already write in your routes file.
-
namespace
support`namespace :v1 do resources :books end
It falls back to Rails default behavior.
-
scope
supportscope :v1 do resources :books end scope module: :v1 do resources :books end
It falls back to Rails default behavior. In this example it recognizes
/v1/books
and/books
expectingBooksController
andV1::BooksController
respectively. -
Nested resources support
modular_routes do resources :books do resources :comments end end
It recognizes paths like
/books/1/comments/2
. -
Standalone (non-resourceful) routes
modular_routes do get :about, to: "about#index" end
It expects
About::IndexController
to exist incontrollers/about/index_controller.rb
. They don't belong to a resourceful scope.If
to
doesn't matchcontroller#action
pattern, it falls back to Rails default behavior.