-
It extends routing API of rails by leting us inherit routes between versions:
version_namespace :api do version_namespace(:v10,:cache_route => true) do resources :articles resources :comments resources :notes end version_namespace(:v11, :cache_route => true) do inherit_routes("/api/v10", :except => %w(articles)) resources :articles resources :tags end version_namespace(:v12) do inherit_routes("/api/v11",:except => %w(notes)) resources :lessons end end
Important thing to remember is only routes which were cached via
cache_route => truecan be reused for inheritance. Normal namespace blocks aren't cached. -
Dynamically defines controllers between versions. In other words if v11 inherits 'notes' route from v10, and v11 doesn't have its own NotesController defined the, plugin will automatically define
Api::V11::NotesControllerwhich will inherit fromApi::V10::NotesController. -
Inherits view files (such as index.xml.builder) between versions. For example if
V11::ArticlesControllerinheritsV10::ArticlesControllerit will as well inherit all the view files ofv10/articles/and hence there won't be any need to copy the view files around when creating new version of the API.Template inheritance will work out of box on Rails 3.1, but if you are still on 3.0.x series, you can use it now :
class Api::V10::BaseController < ActionController::Base restful_route_version end
-
Works with Ruby 1.9.2 and Ruby 1.8.7
-
Notifications
You must be signed in to change notification settings - Fork 5
A Rails plugin to allow versioning of restful routes
License
Unknown, MIT licenses found
Licenses found
Unknown
LICENSE
MIT
MIT-LICENSE
codemancers/restful_route_version
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
A Rails plugin to allow versioning of restful routes
Resources
License
Unknown, MIT licenses found
Licenses found
Unknown
LICENSE
MIT
MIT-LICENSE
Stars
Watchers
Forks
Packages 0
No packages published