[edge Rails] :only/:except options for map.resources

Today a nice option for the routes was commited to the Rails edge.

map.resources now allows the option :only and :except to specify which routes should be created. Both options accept :none, :all, one action name or an array of action names.
For example:

map.resources :user, :only => :create
# GET /users fails
# only POST /users is available
 
map.resources :comments, :except => [:update, :destroy]
# GET /comments etc. works
# PUT /comments/1  fails
# DELETE /comments/1 fails

If you have a lot of resources in your routes this allows you to cut memory consumption.

Comments

One Response to “[edge Rails] :only/:except options for map.resources”

  1. piano tuning cost on January 28th, 2009 12:31 am

    Лучший инструмент для удержания мужчины – ваши руки.

Leave a Reply




Technorati Profile