Skip to content

Releases: vitoravelino/modular_routes

0.3.0

31 Aug 10:14
099f854
Compare
Choose a tag to compare
  • root helper will raise a syntax error indicating that it should be used outside of modular_routes block.

  • concern and concerns 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

21 Jul 13:16
3ae8432
Compare
Choose a tag to compare

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 support

      scope :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 expecting BooksController and V1::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 in controllers/about/index_controller.rb. They don't belong to a resourceful scope.

    If to doesn't match controller#action pattern, it falls back to Rails default behavior.